I have the following BAT file which is intended to archive the specified folder, protect it by a password and copy the archive file to my local Dropbox folder.
"C:\Program Files\7-Zip\7z.exe" a -mx9 archive.7z "G:\This is a test\directory\with subdirectories\" -psecret -mhe=on
xcopy "G:\This is a test\directory\with subdirectories\archive.7z" "G:\My Documents\My Dropbox\" /c /d /s /e /k /y
I use 7-Zip for archiving.
Is it possible to alter the script in such a way that I can put it in any folder I choose and it does the same - archive the current folder, protect it by a password and copy the archive file to my local Dropbox folder?
Simply said, what is the command for "archive the current directory and any sub-directories"?
MS-DOS and Windows command line current directory To list the files in the current directory use the dir command, and if you want to change the current directory, use the cd command. You can use the chdir command by itself to print the current directory in MS-DOS and the Windows command line.
To see them in the terminal, you use the "ls" command, which is used to list files and directories. So, when I type "ls" and press "Enter" we see the same folders that we do in the Finder window.
For instance, if you wanted to change the drive from C: to D:, you should type: d: … and then press Enter on your keyboard. To change the drive and the directory at the same time, use the cd command, followed by the /d switch.
%CD%
is your current directory. Try echo %CD%
in a dos prompt to try it out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With