Tag Archives: one-liner

One-liner: duplicate a folder collection, without files

New fiscal year; new set of empty folders, but with the same structure and permissions as the previous year? Robocopy to the rescue:

robocopy "FY 2015" "FY 2016" /e /xf * /COPY:DATSO /log:c:\temp\new-year-folders.log /tee

/e = copy all subdirectories, even empty ones.
/xf * = Exclude filenames matching *, i.e., all of them
/COPY:DATSO = what to copy: Data, Attributes, Timestamp, Security, and Owner.
I like to log things, so I include that, too. If you’re really cautious, you could do a dry run with the /L switch, which makes robocopy just log what it would do, but not actually perform any actions. Kind of like the PowerShell -whatif switch.

Geoff Duke

July 2, 2013

Wondering about the physical memory configuration of a system?

PS> gwmi Win32_PhysicalMemory | ft DeviceLocator,@{l='Size (GB)';e={$_.Capacity / 1GB} } -a

Geoff Duke

June 23, 2013

Camera named files like this: P1050640.JPG. To rename the all files in the directory, I used the following:

PS> $i = 1; gci | % { ren $_ $( '2013 Pool Setup {0:D2}.JPG' -f $i++ ) }