Search code examples
windowsbatch-filecmdxcopy

Copy all desktop.ini using xcopy


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?


Solution

  • 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.