Okay here we go.
Usually it is not that hard to move a csv file from one subfolder to another subfolder in the same directory, BUT here's my challenge/question.Only the subfolder (lowest level) containing the file and the folder one level up, are known.
The entire directory structure is unknown (for easier maintenance of all the batch files being used, but that's a whole new subject).What batch command can/must I use to move the csv file from 00_Create_export_file to 04_Backup_file?
My folder structure (in Windows XP) is:
Source ?:\?\?\?\AccountNumber\00_Create_export_file
Target ?:\?\?\?\AccountNumber\04_Backup_fileCan you help me out?
Thanks!
Perhaps you'd like to explain why the directory structure is unknown?
Hello Razor, The reason is that I have to transfer the \AccountNumber\Subfolders to application support. I don't know (yet) in what directory they will copy the batch file structure. So for the sake of being helpful I wanted to provide a solution that's independent of their choice.
Could a PATH or %~dp0 be an option? If so, how?Thanks!
Read up on working directories and relative paths. If the user starts the script from explorer, the working directory will be wherever the script lives. If the user starts the script from a shortcut, the working directory is specified by the "Starting in" field. The one exception is if the user starts the script from an unmapped network share.
Will do Razor. Thanks for your response and directions!
This is what works. The link offers other posibilities, but in the time I had, following was most usefull: :: Copied from http://stackoverflow.com/questions/...
@echo off
setlocalgoto MAIN
::-----------------------------------------------
:: because entire path is unknown and only the current and parent folder are known,
:: use following function to work with those 2 (independent of rest of dir or location).
:: That way you can move a(ny) file from current working folder to another folder on same level.
:: "%~f2" get abs path of %~2.
::"%~fs2" get abs path with short names of %~2.
:setAbsPath
setlocal
set __absPath=%~f2
endlocal && set %1=%__absPath%
goto :eof
::-----------------------------------------------:MAIN
call :setAbsPath ABS_PATH ..\
echo %ABS_PATH%move %ABS_PATH%\00_Create_export_file\Export_account_numbers*.csv %ABS_PATH%\04_Backup_file\
endlocal
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |