Hi Jayashree,
if you like you could use ExtendScript's File and Folder objects to do that.
See into DOM documentation for methods and properties:
https://www.indesignjs.de/extendscriptAPI/illustrator21/#File.html
https://www.indesignjs.de/extendscriptAPI/illustrator21/#Folder.html
Below a code sample:
/*
ExtendScript ( JavaScript ) code:
1. Gets the user's Documents folder
2. Writes all files of that folder with suffix *.ai to an array.
3. Creates a new folder in the user's Documents folder.
4. Loops the files array to copy every file to the new folder.
*/
var newFolderName = "NewFolderName";
// This defines a standard folder of the Folder object.
// The user's Documents folder
var sourceFolder = Folder.myDocuments;
// Get all AI files in the user's Documents folder:
var filesArray = sourceFolder.getFiles
(
// FILTER FUNCTION:
function( file )
{
if
(
file instanceof File
&&
file.name.match(/\.ai$/)
){ return true };
}
);
// Definition of the new folder:
var newFolder = Folder( sourceFolder.fullName +"/"+ newFolderName );
// Test if that folder already exists. If yes, do nothing, if no, create it:
if( !newFolder.exists ){ newFolder.create() };
// Loop the filtered file array to copy every file in the array:
for( var n=0; n<filesArray.length; n++ )
{
var currentFile = filesArray[n] ;
var copyOfFile = File( newFolder.fullName +"/"+ currentFile.name );
// Do nothing if the file already exists:
if( copyOfFile.exists ){ continue };
currentFile.copy( copyOfFile );
};
The script could be executed by Adobe Illustrator.
Regards,
Uwe Laubender
( ACP )