DOS command to Copy a file from parent dir to specific folder within many child directories?

If you know all the child directories before hand the simplest solution is batch files tutorial on batch files.

If you know all the child directories before hand the simplest solution is batch files tutorial on batch files I don't know how loops work in ms dos but in linux bash shell loops are simple to program.. Any ways batch files are the simplest option.

Thank-you. I was trying to avoid maintaining a master list of all the directories as we keep adding/deleting over time...thought I could create a dynamic loop to search for LIB within children, and post the new file. Anyway, I will give the tutorial link a shot too!

Thank-you for your help. – MarkG Jul 18 '11 at 17:06.

If you can download cygwin then you can use the following bash script to do the job without hardcoding it The code P. S you will need to change the name of the folder from tmp to LIB and the filename from LOL to your file name .. The script is pretty self explanatory. Unix shells are better than MS-DOS so it might be a good idea to get cygwin anyways.

P. S leanrn bash instead of DOS.. you won't regret it – Osama Javed Jul 18 '11 at 17:43.

Here's a command that can get you started: FOR /F "delims=" %%D IN ('DIR /b /a:D /s C:\Parent\LIB') DO @ECHO COPY "C:\Parent\library. Eds" "%%~D" Once you get it working the way you want, remove the @ECHO part to actually do the copy: FOR /F "delims=" %%D IN ('DIR /b /a:D /s C:\Parent\LIB') DO COPY "C:\Parent\library. Eds" "%%~D" Extra help for these commands HELP FOR HELP DIR How this works FOR /F ... %variable IN ('command') DO otherCommand %variable... This lets you execute command, and loop over its output.

Each line will be stuffed into %variable, and can be expanded out in otherCommand as many times as you like, wherever you like. %variable in actual use can only have a single-letter name, e.g. %V."delims=" This lets you ignore any whitespace output by 'command', so it properly handles directories that have spaces in their names. DIR /b /a:D /s C:\Parent\LIB This will search for all files under C:\Parent that have the name LIB.

It will recursively go through subdirectories because of /s.It will only find directories (because of /a:D). It will output them in a way that is useful for looping, because of /b. %%D instead of %D This is required in batch files.

If you did this on the command prompt, you would use %P instead.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions