We become indebted to.
1. I want to achieve
After allocating to the drive with the net use command, use the xcopy command to copy the one in the specified folder of storage to the folder of the server to be released.
I was able to copy it, but after that, the process of deleting the entire folder contained in the file from the folder in the specified location of the storage did not go well, and I am struggling.
I tried using the del command, but what other commands can be used to delete the entire folder contained in the file?
I would appreciate it if you could tell me. I look forward to working with you.
The drive assigned to the specified folder of the storage is the A drive, and the drive assigned to the folder of the release server is the B drive.
3. Batch file statement created by myself
Connect to a specified location in storage with rem net use
net use A: (Enter your full path here) (Enter your password here)/user: (Enter your domain name here) \ (Enter your ID here)
rem net use Connect to a folder on the server to release
net use B: (Enter your full path here) (Enter your password here)/user: (Enter your domain name here) \ (Enter your ID here)
Copy the folder in the specified location of rem storage to the specified folder on the server to be released.
xcopy A: \ (folder name in the specified storage location) B: \ (folder name specified on the server)/I/S/E/Y/Q
If the rem copy is successful, delete the entire folder contained in the file from the folder in the specified location of the storage.
del/q A: \ (folder name) \
Disconnect rem A drive
net use A:/delete
Disconnect rem B drive
net use B:/delete
Answer # 1
From the comment in the "Request for addition/correction to question" column [2020/11/14 22:48]:
For example, if the folder name is "FOLDER", do you delete the entire A: \ FOLDER? Or do you delete the files and folders under A: \ FOLDER?
⇒ "Are you sure you want to delete the files and folders under A: \ FOLDER?"
If you delete the entire "A: \ FOLDER"
RMDIR/Q/S A: \ FOLDERIt's a one-shot, but it's a little troublesome to leave the specified original folder. The files directly under the specified folder are
DELDelete with the command, and the folders (including files) under it
RMDIRThe following is an example of a batch file (* .cmd) that is deleted one by one with a command.
TARGETDIRSpecify the PATH of the folder in the variable. In this example
S: \ WORK \ FOLDER \It is said.
set TARGETDIR = S: \ WORK \ FOLDER \ if ""% TARGETDIR% "" ==" "" "goto END rem Delete only the files directly under the specified folder del/q% TARGETDIR% * Delete per rem folder for/D %% F in (% TARGETDIR% *) do ( rmdir/q/s %% F ) : END
TARGETDIRVariable value is empty (
""), From under the current directory when executing the batch fileAll folders and files will be deleted.Therefore, in the above example, if it is an empty string, it is skipped. Please understand the contents and use with caution when using it as a reference.
- Ten Linux command aliases that can improve efficiency
- Share 50 tips to improve PHP execution efficiency
- Spark-shell batch command execution script method
- Implementation method of hive-shell batch command execution script
- bat batch for command quick start
- Use anyproxy to improve the collection efficiency of public account articles
- expect command to achieve batch ssh password-free under linux
- Improve efficiency by precompiling regular expressions in python
- Windows command line bat batch delay sleep method (batch delay)
- Detailed examples of shell command line batch processing of image file names
- Detailed svn command line batch operation on Linux
- google apps script - i created a batch conversion function using the translation api, but batch output does not work
- 5 tools to improve the efficiency of Linux development
- Mysql solution to improve the efficiency of large data table copy
- How to improve the programming efficiency of PHP programming development
- Detailed explanation of linux command line batch creation directory
- Php find array elements to improve efficiency
- Guide to using the batch for command
- Improve efficiency and accuracy with well-formed SQL
- python - [beginner] i don't know how to write a bat file i want to run py
- please teach me how to omit prompt command input in batch file or other methods
- command - i want to sort files using a batch file
- powershell - run ps1 want to make ps1
- command - i want to install the package libhdf5-dev used by keras
- batch file command
- windows - i want to count the number of tabs for each line in the file
- command - i want to execute a python program in anaconda environment from bat file
- command - i want to create a batch that can output the contents of multiple logs as a text file