copy - batch file copies folder and pastes it the location where the batch file is run from -



copy - batch file copies folder and pastes it the location where the batch file is run from -

this batch based skill required programme used backup info

the batch file stored on removable device like:

pendrive flashdrive sdcard (memory card)

when batch file executed must collect folder found @ location "x"

d:/music

all info in folder must copied location of batch file

if batch file located @ of these points

e:/ f:/ g:/ z:/

the batch operation should know located , re-create music folder , paste batch file run

my device when connected via usb changes (e:/music) (f:/music) batch file root folder

pc e:/music (fixed location)

code batch copies content in e:/music batch pastes content drive e:/ or f:/ without errors batch file must know

can please help me useful , resourceful because can save content device , little

this simple batch file job:

@echo off if exist "d:\music\*" ( echo deleting %~d0\music ... rd /s /q "%~d0\music" 2>nul echo copying d:\music %~d0\music ... xcopy "d:\music\*" "%~d0\music" /s /e /c /i /q /h /k echo folder d:\music copied drive %~d0 pause )

i used info printed running in command prompt window commands:

cmd /? ... outputs help command cmd interpreter of batch files, , listing internal commands of command line interpreter cmd. for /? ... outputs help command for info ~d drive string argument 0 of batch file referenced %0 name of batch file path. rd /? ... outputs help command rd info how silently delete entire directory tree. xcopy /? ... outputs help command xcopy info how silently re-create entire directory tree.

the command rd used first remove target directory on removable media before copying files source directory avoid mixture of new , old folders , files.

the command xcopy used re-create entire directory tree of d:\music removable media silent. total number of copied files output think see.

batch-file copy paste

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -