Not Just Paranoid

Another site by Pete Maynard

Get a list of filenames and move the files Bash and Power Shell

Both these scripts do the same thing, they strip a log file down to the filename and then move each file up a directory.

...
C:\Random\Directory\n\chars\long\filename.xml
...

BASH

cat 15\ August\ 2011\ Less.log | cut -c 113-152 > fileNames
for i in `cat fileNames`; do mv -v "$i" ../$i; done

WINDOWS

gc '.\15 August 2011 Less.log' |% {$_.Substring(56,20)} > fileNames
gc .\filenames | ForEach-Object {mv -v $_ ../$_}

Just my little note, from when I was playing with power shell. More than likely more to come >.>

17 Aug 2011 | Tags ( bash Windows Power Shell )

Website Last Updated on 15 Sep 2023 (CC BY-SA 4.0)

This site uses JQuery and nanogallery2 hosted by jsdelivr.net
for the Flickr photo feed and GoatCounter for user insights.