Page 1 of 1

move and rename

Posted: 14 Sep 2012 10:43
by calude
Hi
sorry bothering you for a simple 2 line script

what I would like is
1- select one file (google.csv)
run script
the files gets moved to a folder already populated by
google_contacts_all_02.csv
google_contacts_all_03.csv
google_contacts_all_04.csv
google_contacts_all_05.csv
google_contacts_all_06.csv
google_contacts_all_07.csv

and the file gets renamed you guess it
google_contacts_all_08.csv

next time I do the script
google_contacts_all_09.csv

Have tried several times
with
moveto and then rename or renameitem
or the other way around

as I'm not a scripter, I used trial and error and went nowhere

thanks for helping me solving this

Calude

Code: Select all

moveto D:\CV_mes_documents\Document\google_contact_backs\
 renameitem("google_contacts_all_", , , "01");

Re: move and rename

Posted: 14 Sep 2012 10:57
by highend
Create a dummy entry in that folder named
"google_contacts_all.csv"

and use:
renameitem("google_contacts_all", , , "_01");

Re: move and rename

Posted: 14 Sep 2012 11:08
by calude
Hi thanks helping me

tried your "dummy" suggestion and got an error:
Dépassement de capacité
0 \ 0

(overflow) I guess

Calude


Code: Select all

 moveto D:\CV_mes_documents\Document\google_contact_backs\
 renameitem("google_contacts_all", , , "_01");

Re: move and rename

Posted: 14 Sep 2012 12:19
by highend
Change your paths...

Code: Select all

setting('BackgroundFileOps', 0);
 $item = "<curname>";
 moveto "D:\temp\";
 renameitem("google_contacts_all", "D:\temp\".$item, , "_01");

Re: move and rename

Posted: 14 Sep 2012 12:38
by calude
highend
thanks a lot
works perfect

Have a nice Day

Calude