Hi Team,
I need to move a selected files from a folder based on the selected drop down menu names.
EG:
If a need to move a file "A" to Raavan, then the file should get moved to the name accordingly, when a name is selected from a drop down menu.
Files and names are not constant, they may differ.
Can anyone help me out.
move file based on drop down menu names
move file based on drop down menu names
This will answer both your posts about moving files. Info about file and folder objects, their properties and methods can be found in the javascript tools guide.
To move a file you first copy the file to the new location. Make sure the copy was successful. Then delete the original file.
I don't think it is a good idea to move the file of an open document. Either move it before opening or move it by using savaAs to save in a new location.
To move a file you first copy the file to the new location. Make sure the copy was successful. Then delete the original file.
I don't think it is a good idea to move the file of an open document. Either move it before opening or move it by using savaAs to save in a new location.
move file based on drop down menu names
Hi Mike,
Thanks for you support.
Then can we split it into 3 ways:
1. First it should copy to a new location as a backup
2. And from there it should get copied to predefined folder
3. And after the above process, simultaneously the original should be deleted.
Project:
We have a folder from where we receive images to work, more than 5 optrs work at a time. Whenever files are dropped, we use to take the images individually. In this case when the images are taken from that folder by automation, we may take the repeated images.
To avoid this error i am asking for the above process.
Help me out with codes or a guide to have a code.
Thanks for you support.
Then can we split it into 3 ways:
1. First it should copy to a new location as a backup
2. And from there it should get copied to predefined folder
3. And after the above process, simultaneously the original should be deleted.
Project:
We have a folder from where we receive images to work, more than 5 optrs work at a time. Whenever files are dropped, we use to take the images individually. In this case when the images are taken from that folder by automation, we may take the repeated images.
To avoid this error i am asking for the above process.
Help me out with codes or a guide to have a code.
move file based on drop down menu names
Something like this. Change the top three paths to match your folders. Note: it expects the folders to exists and for you to choose a file that can be opened in Photoshop. If there is a copy error it stops without tying to deal with that error.
Code: Select allvar sourceFolder = new Folder('~/desktop/incomming');// change to folder from where you receive images
var backupFolder = new Folder('~/desktop/backup');// chagne to your backup folder
var destFolder = new Folder('~/desktop/working');// change to folder where you want the file moved to
//////////////////////////////////////////////////////////////////////
var tempFile = new File(sourceFolder+'/choose_a_file');
tempFile = tempFile.openDlg('Select file to copy and work with');
if(tempFile != null){
var saveName = tempFile.name;
var res = tempFile.copy(new File(backupFolder+'/'+saveName));
if(res != true) throw('Unable to move file to '+decodeURI(backupFolder));
res = tempFile.copy(new File(destFolder+'/'+saveName));
if(res != true){
throw('Unabe to move file to '+decodeURI(destFolder));
}else{
// if we get here then the file has been backuped and moved to new folder so delete
tempFile.remove();// can not be undone
app.open(new File(destFolder+'/'+saveName));// open moved file to work on
}
}
Code: Select allvar sourceFolder = new Folder('~/desktop/incomming');// change to folder from where you receive images
var backupFolder = new Folder('~/desktop/backup');// chagne to your backup folder
var destFolder = new Folder('~/desktop/working');// change to folder where you want the file moved to
//////////////////////////////////////////////////////////////////////
var tempFile = new File(sourceFolder+'/choose_a_file');
tempFile = tempFile.openDlg('Select file to copy and work with');
if(tempFile != null){
var saveName = tempFile.name;
var res = tempFile.copy(new File(backupFolder+'/'+saveName));
if(res != true) throw('Unable to move file to '+decodeURI(backupFolder));
res = tempFile.copy(new File(destFolder+'/'+saveName));
if(res != true){
throw('Unabe to move file to '+decodeURI(destFolder));
}else{
// if we get here then the file has been backuped and moved to new folder so delete
tempFile.remove();// can not be undone
app.open(new File(destFolder+'/'+saveName));// open moved file to work on
}
}
move file based on drop down menu names
Thanks Mike
Its really superb. Works fine too.
Can we pick multiple images, so then we can open 2 or more images at a time to work on.
Its really superb. Works fine too.
Can we pick multiple images, so then we can open 2 or more images at a time to work on.