|
Answer» Hi, I am trying to write a DOS command to copy a file from 2 levels down to a folder 2 level up. How do I do it?
For example, consider the file structure as follows: C:\Level1\Level2\Level3\ Level4\ Level5\ Level6
if i am at
C:\Level1\Level2\Level3
is there a SHORTER method than USING the following command copy C:\Level1\Level2\Level3\ Level4\ Level5\test.c C:\Level1\test1.c
is there a way to use the reference from my current directory?
Thanks in advancehow about setting a variable for your current directory..? then use the variable in your copy command...Ghostdog's method would certainly be self documenting and readable. If you prefer your batch language cryptic and obscure:
Code: [Select]copy Level4\Level5\test.c ..\..\test.c
Personally I prefer your original method as it can be run from any location on the machine. Relative pathing may offer a few SHORTCUTS, but try reading the code six months from now. PC's offer many ways to do the same thing. Use whatever method you're most comfortable with.
8-)
If your DOS version has the subst command, you can use that to assign a drive letter to a directory, then use the drive letter instead of the full path.
|