Move files from one folder to another
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Move files from one folder to another
I need to move files from one folder to another, but I want to check to see if the file already exist in the new folder and if it does, I want to rename the file before I move it, so that I have all copies of that file.
I plan on moving each file to a folder name based on the file's extension.
All PDFs into a folder named PDF, all DOCs into a folder named DOC, etc.
I already have a vbscript to list all of the files in a folder and all its subfolders, just need to create a function to move the files and create the subfolder if it doesn't already exist.
Can someone please help me or direct me to an example?
Move files from one folder to another
I need to move files from one folder to another, but I want to check to see if the file already exist in the new folder and if it does, I want to rename the file before I move it, so that I have all copies of that file.
I plan on moving each file to a folder name based on the file's extension.
All PDFs into a folder named PDF, all DOCs into a folder named DOC, etc.
I already have a vbscript to list all of the files in a folder and all its subfolders, just need to create a function to move the files and create the subfolder if it doesn't already exist.
Can someone please help me or direct me to an example?
Move files from one folder to another
Look into the Scripting.FileSystemObject. It can get you all of the pieces you need to determine the extension of teh file name and the exitence of files and folders.
http://msdn.microsoft.com/en-us/library ... s.71).aspx
Consider using PowerShell as it is better at doing this.
http://msdn.microsoft.com/en-us/library ... s.71).aspx
Consider using PowerShell as it is better at doing this.
Move files from one folder to another
Thanks jvierra, I have the FileExist and Move down, it's the logic to check if I already have a renamed file in the Target folder and figuring out the version number so that I can increment the file number.
Example, if FileName(4).ext already exit, rename the next one FileName(5).ext
Hope someone can help me out.
Example, if FileName(4).ext already exit, rename the next one FileName(5).ext
Hope someone can help me out.