|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Move folders using input from CSV
another. No problem if they were sequential...however, they are not. I have an input file in CSV format (actually it's an Excel file right now) that contains the folder names to move. I need to generate a script that will walk through this file one line at a time and compare my source location with the destination location. if the folder name exists in the destination the script would move on to the next one with no changes (or even log the issue). Example: - moving folders from c:\test\ to d:\ - example folders in c:\test\ are: 1001, 1003, 1009, 1010, 1011 and 1015 - example folders in d:\ are: 1001, 1011 and 1015 - script should move all folders (and their contents) except for the 3 that exist in destination - CSV input file will have all folder names (1001, 1003, etc.) on an individual line Thanks! Mark R.
Show quote
"Mark R." wrote: Hi Mark,> I need to move thousands of folders (and their contents) from one location to > another. No problem if they were sequential...however, they are not. I have > an input file in CSV format (actually it's an Excel file right now) that > contains the folder names to move. I need to generate a script that will walk > through this file one line at a time and compare my source location with the > destination location. if the folder name exists in the destination the script > would move on to the next one with no changes (or even log the issue). > Example: > > - moving folders from c:\test\ to d:\ > - example folders in c:\test\ are: 1001, 1003, 1009, 1010, 1011 and 1015 > - example folders in d:\ are: 1001, 1011 and 1015 > - script should move all folders (and their contents) except for the 3 that > exist in destination > - CSV input file will have all folder names (1001, 1003, etc.) on an > individual line > > Thanks! > > Mark R. please try the batch script below with your source and destination paths. take note on word wrapping, and there is only one command line in the batch script. It will echo the move command to run. If the echo command display correctly what you want, then you can edit the script by removing "@echo" and run again. ------------------------ for /f "usebackq" %%a in (`dir c:\test\source /ad /b`) do @if not exist c:\test\dest\%%a @echo move "c:\test\source\%%a" "c:\test\dest\" ------------------------ rgt, neothwin |
|||||||||||||||||||||||