I use this command in order to copy all .ini files (with recursion):
xcopy c:\folder1\folder1A\*.ini c:\mybackup /sy It doesn't copy any file.
There exist desktop.ini files (including comments) within folders and subfolders of folder1A that I want to get a copy of with recursion.
I have tried running CMD as administrator, but it tells 0 File(s) copied. How could I get this to work?
Add the /h option:
/H Copies hidden and system files also. (more info)
This works:
xcopy c:\folder1\folder1A\*.ini c:\mybackup /syh
Thanks to Marged's comment mentioning this question.
Related
I have a large folder of pictures (thousands), and I have a long list of files, by exact file name, that I need to copy to another folder using Windows commands, through cmd prompt only. I use Windows 7.
I want to know if there is a way I can select several specific files from this folder, by name, and copy them to another folder, using the terminal, without copying them individually?.
I know I can do it with xcopy but i want to copy specific types of files only say 'jpeg','bmp',etc.
Try using
xcopy /d /y /s "\Your Image Folder\*.jpg" "C:\Users\%username%\Desktop\Master Image Folder\"
Also you can simply use
copy *.<extension> <other folder>
For example :
copy C:\Users\desktop\*.jpg D:\backup
will copy all files with extension .jpg from path C:\Users\desktop\ to D:\backup\
Something like:
xcopy /s "c:\source\*.jpeg" "c:\destination\"
should do the trick. Additionally, if you type xcopy /?, you should get the documentation. (you can replace .jpeg with whatever file extension you want.
The information on the page Microsoft DOS xcopy command provides considerably more information and guidance.
copy c:\scr\*.jpg c:\dst
copy c:\src\*.bmp c:\dst
I am trying to copy a directory but get the following:
xcopy ..\node_modules\ \node_modules\
0 File(s) copied
I run as administrator, but still get the error. Any ideas please?
p.s I actually use the following to stipulate it's a directory. But the above also fails:
echo d | xcopy /d /y ..\node_modules\ \node_modules\
Thanks
You can use the xcopy /E flag to copy the entire directory and subdirectories. Also remove the starting \ of the destination. The trailing slash should prevent the file or directory prompt.
xcopy /E ..\node_modules node_modules\
xcopy ..\node_modules\* \node_modules\
You are specifying the source directory, but not which files to copy.
To copy all the contents like folder, sub-folder or chain of folders we can use below command:
xcopy file-to-copy-path\ where-to-copy-path\ /s /i
/s copies folders and sub-folders
/i If in doubt always assume the destination is a folder e.g. when the destination does not exist.
This question already has answers here:
How do I copy files using Windows Batch?
(6 answers)
Closed 4 years ago.
I need to create a batch file to copy certain files (e.g., 19_1_White.jpg) to a folder within the directory. How can I do this?
XCOPY F:\*.* G:\ /C /S /D /Y /I
XCOPY allows for copying of files, directories, and sub directories.
F:\*.* is our source location
G:\ is our destination location
/C tells XCOPY to ignore errors, and finish what can be done
/S tells XCOPY to copy everything including directories and
subdirectories
/D tells XCOPY to only copy source files that are newer than the
destination files (big time saver on the process)
/Y tells XCOPY to overwrite files without asking for confirmation
/I tells XCOPY to automatically create new directories on the
destination, if new directories were created in source.
you need to use the command XCOPY
eg XCOPY A.jpg C:\Folder\A.jpg
Take a look at https://support.microsoft.com/en-us/help/289483/switches-that-you-can-use-with-xcopy-and-xcopy32-commands for any other switches you may want to use too.
I need to copy-paste a folder (files + subfolders) into a BackUpfolder. I also need to append the time into the BackUp folder name. xcopy command is letting me copy only files. Your help would be appreciated.
Source Folder = "C:\Documents and Settings.....\Project" (has many files + subfolders)
Target Folder = "C:\Backup-Date/time of backup" Eg Bacup:May 16 2011 12:30 AM
I plan to run this bat file through Scheduler. Thanks!
XCOPY
Copy files and/or directory trees to another folder. XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.
XCOPY is particularly useful when copying files from CDROM to a hard drive, as it will automatically remove the read-only attribute.
Syntax
XCOPY source [destination] [options]
/S Copy folders and subfolders
/E Copy folders and subfolders, including Empty folders.
May be used to modify /T.
/H Copy hidden and system files and folders (default=N)
Key
source : Pathname for the file(s) to be copied.
destination : Pathname for the new file(s).
There are several options you can look at :http://ss64.com/nt/xcopy.html
Soruce: http://ss64.com/nt/xcopy.html
I think reading the documentation of xcopy would go a long way.
What should I write into the .bat file for it to find all files with same names in folder (and it's sub folders) and replace them with file from another file (from another folder)?
Is there any fast way if we have 1 000 000 folders with nearely 10 000 files for replacement?
Try
XCOPY /U
/U will make it only copy files from the source to files in the destination, it won't copy any files that do not already exist (which is what I think you are asking for).
To copy files with the same names from c:\weebles to c:\wobble you would do
XCOPY c:\weebles c:\wobble /U /Y
Specify /U to only copy files that already exist in the destination
Specify /Y to copy without asking your permission to overwrite each file (will get tedious really quick).
For more info, open a command prompt and type
help xcopy
IMPORTANT: Before you try this (or a variant) do either:
A backup of your destination folder
A test on some folders that don't matter
Would be a shame to go all gung ho, start the copy then regret it! :-)