tag: Windows Power Shell

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

17 Aug, 2011 - 1 minutes
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.