Copy link to clipboard
Copied
Hello Everyone,
The below screen grab is my existing folder.
Step 1: I would like to create a folder named with the file naming given above (chapter_001). The new folder looks like, chapter_001_01.
Step 2: I would like to move above files (3 files) to newly created folder.
Step 3: Again, create a folder named with the file naming given above (chapter_004). The new folder looks like, chapter_004_01.
Step 4: Again, move above files (3 files) to newly created folder.
As I am a beginner for this Javascript, I am unable to think that is possible to make a script to run this process.
It would be great if you could help me know whether this is possible for JS.
Thank you!
Hi sarshan​,
same principle as in your last thread:
- // for Windows
- var folder1 = Folder("/x/qa/Team/Saravanan");
- if (!folder1.exists) {folder1.create();}
rewritten
// for Windows
var curFolder = new Folder("/x/qa/Team/Saravanan/mergefiles/guna");
Have fun
Copy link to clipboard
Copied
Why would you want to do that in Photoshop?
Copy link to clipboard
Copied
Try this script. You need to change line one to the path of your current folder:
var curFolder = new Folder(Folder.desktop + '/Current Folder')//Change the path to wherever your current file is located
var mask = '*.xhtml';
var fList = curFolder.getFiles (mask);
var counter = 1;
var nextFolder;
var nextFolderName;
for(var i=0;i<fList.length;i++){
if(counter ==1){
nextFolderName = fList.name.split('.')[0];
nextFolder = new Folder(curFolder + '/' + nextFolderName + '_01');
if(!nextFolder.exists){nextFolder.create()};
}
counter++;
if(counter ==4){counter = 1};
fList.copy(nextFolder +'/' + fList.name);
fList.remove();
}
Copy link to clipboard
Copied
Thank you for sharing this script.
I would like this script to run in Windows rather than Mac and also like to add the location mentioned below.
Copy link to clipboard
Copied
Hi sarshan​,
same principle as in your last thread:
- // for Windows
- var folder1 = Folder("/x/qa/Team/Saravanan");
- if (!folder1.exists) {folder1.create();}
rewritten
// for Windows
var curFolder = new Folder("/x/qa/Team/Saravanan/mergefiles/guna");
Have fun
Copy link to clipboard
Copied
Thank you
It's very useful
Copy link to clipboard
Copied
You're welcome.
Credits should go to Chuck Uebele​
sarshan​, did you tried his script snippet? Does it works for you?
Copy link to clipboard
Copied
Yes, It works perfectly.
Thanks again!
Copy link to clipboard
Copied
Schubser,
Is that possible to assign the location and number of files manually?
I want to assign the location and number of files manually because the numbers is not constant.
Thanks
Copy link to clipboard
Copied
give us examples please
Copy link to clipboard
Copied
As given below, I want to set the location and number of files to be moved as user input.
For more example:
1. Once I hit the script using panel will ask as user input.
2. After I enter the file name, a folder needs to be created.
3. Again the script will ask how many files to moved with created folder.
4. As soon as I give the numbers, the files to be moved.
I don't know if this possible in adobe scripting. But, If it works as needed, it would be much appreciated.
The below script does that what I need but I can't set the location and the number of files through user input.
Cheers