PPRuNe Forums - View Single Post - a fast way to replace 1000+ files?
View Single Post
Old 10th February 2009 | 18:31
  #11 (permalink)  
In rerum natura
15 Anniversary
 
Joined: Apr 2008
Posts: 27
Likes: 0
From: UK
Mac

The last time I wrote batch files in anger I had to type copy con: my_file.ext at the DOS prompt and terminate the text with ^Z and a quaint thing called a carriage return (anything was better than edlin). But my %%n is a variable and not a parameter so I don't think the shift command is syntactically relevant (chemo brain...I even lost my specs in the snow...so I am happy to stand corrected). SD? As I said, I did test the 'program' after I scribbled it down and before posting. Very quick and dirty, no errorlevel, if exist, if not exist checks and no clean up afterwards. But non-destructive, at least.

Of course, the source and destination paths and file names could be passed as parameters (%1..%9) from the command line in which case the shift command might become pertinent (that's something for you to do, Homer, find that out). But all the meat is in the last line (which is essentially the Bash command suggested by Shunter), which was sufficient to answer the OP's question. Thanks for the page linked to, though, which I have saved to disk and will study later; Microsoft's help page for XP batch file commands is very limited in its scope. Looks like you're expected to part with even more money for books which used to be supplied with the OS (GW Basic reference, command line reference, batch file reference). For a really hard core batch file (whose workings I don't for a moment pretend to understand) have a look at this:
Stupid Coding Tricks: A Batch of Pi - The Daily WTF

FOR /f %n IN (filelist.txt) DO COPY /Y blank.bmp %n
can be entered at the command prompt in source=target directory but is destructive.
IRN

Last edited by In rerum natura; 26th March 2009 at 01:22. Reason: The fidgets
In rerum natura is offline  
Reply