Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Windows SendTo Shortcuts - Copy with Date and Rename with Date

by Melly (Hermit)
on Jan 31, 2010 at 10:27 UTC ( #820564=CUFP: print w/replies, xml ) Need Help??

A couple of little shortcuts for Windows to put in your "Send To" folder...

This one makes a copy of the selected file, but appends the date and time - e.g. out.txt creates out_20101311022.txt

C:\Perl\bin\wperl.exe -e "use File::Copy;$ARGV[0]=~/(.*\\)([^\\\.]*)(. +*)/;$file=$1.$2.'_'.(join'',(localtime)[5]+1900,(localtime)[4]+1,(spr +intf\"%.2d%.2d%.2d\",(localtime)[3,2,1])).$3;copy($ARGV[0],$file);"

This one is almost identical, but renames rather than copies...

C:\Perl\bin\wperl.exe -e "$ARGV[0]=~/(.*\\)([^\\\.]*)(.*)/;$file=$1.$2 +.'_'.(join'',(localtime)[5]+1900,(localtime)[4]+1,(sprintf\"%.2d%.2d% +.2d\",(localtime)[3,2,1])).$3;rename $ARGV[0],$file;"

And just for completeness, here's to the clipboard as filename (which I've posted before):

C:\Perl\bin\wperl.exe -e "use Win32::Clipboard;$clip = '\"' . $ARGV[0] + . '\"';Win32::Clipboard($clip);"

Hope someone finds these useful...

map{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e**2 -$d**2+$b);$c=$d**2+$e**2>4?$d=8:_}1..50;print$c}0..59;print$/}0..20
Tom Melly, pm (at) cursingmaggot (stop) co (stop) uk

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://820564]
Approved by planetscape
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2017-04-25 12:00 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (451 votes). Check out past polls.