request:select files by type , move each type to new folde

Discuss and share scripts and script files...

request:select files by type , move each type to new folde

Postby yusef88 » 21 Dec 2013 03:47

hi dear members :)
select files by type and move each type to new folder with customized name,
i need a basic script and if possible i'll add desired extension
example:
select all "flv , mp4" and move to new folder video
select all "jpg , png" and move o new folder picture
select files has no extension to new folder undefined
is that possible?
========
"Video|Video Files" {:Video}
"Image|Image Files" {:Image}
those filter can't help?
======
i want add date to folder name video2013-12-21
yusef88
 
Posts: 199
Joined: 28 Jan 2013 03:50

Re: request:select files by type , move each type to new fol

Postby binocular222 » 21 Dec 2013 08:25

Do visual filters such as:
Code: Select all
*.flv|*.mp4
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=9243#p82488
binocular222
 
Posts: 738
Joined: 04 Nov 2008 05:35
Location: Hanoi, Vietnam

Re: request:select files by type , move each type to new fol

Postby yusef88 » 21 Dec 2013 09:34

it will be a convenient way to sort files by type into folders by one click especially when it becomes an iterative process
yusef88
 
Posts: 199
Joined: 28 Jan 2013 03:50

Re: request:select files by type , move each type to new fol

Postby highend » 21 Dec 2013 11:09

Edit the variables in the "_Initialize" section...

Code: Select all
// Move specific filetypes into specific folders
"_Initialize"
    global $extVideo, $videoFolder, $extImage, $imageFolder, $undefinedFolder;

    $extVideo     = "flv,mp4,avi";
    $videoFolder  = "video";
    $extImage     = "jpg,png";
    $imageFolder  = "picture";
    $undefinedFolder = "undefined";


"_LoopFiles"
    global $selExt, $dstFolder;
    $dstFolder = "$dstFolder" . "<date yyyy-mm-dd>";
    setting "BackgroundFileOps", 0;

    $filesToMove = "";
    foreach($item, $selExt, ",") {
        if ($item == "none") {
            $noExtensionFiles = listfolder(, "*", 1, "|");
            foreach($noExtFile, $noExtensionFiles, "|") {
                if (getpathcomponent($noExtFile, "ext") == "") {
                    $filesToMove = $filesToMove . $noExtFile . "|";
                }
            }
        } else {
            $filesToMove = $filesToMove . listfolder(, "*.$item", 1, "|") . "|";
        }
    }
    $filesToMove = formatlist($filesToMove, "e", "|");
    if (exists("<curpath>\$dstFolder") == 0) {
        new("<curpath>\$dstFolder", "dir");
    }
    moveto "<curpath>\$dstFolder", $filesToMove;


"Move video files"
    global $extVideo, $videoFolder, $selExt, $dstFolder;
    $selExt = $extVideo;
    $dstFolder = $videoFolder;
    sub "_LoopFiles";

"Move image files"
    global $extImage, $imageFolder, $selExt, $dstFolder;
    $selExt = $extImage;
    $dstFolder = $imageFolder;
    sub "_LoopFiles";

"Move undefined files"
    global $undefinedFolder, $selExt, $dstFolder;
    $selExt = "none";
    $dstFolder = $undefinedFolder;
    sub "_LoopFiles";
One of my scripts helped you out? Please donate via Paypal if you like: highend (at) web (dot) de
highend
 
Posts: 1405
Joined: 06 Feb 2011 00:33

Re: request:select files by type , move each type to new fol

Postby yusef88 » 21 Dec 2013 21:48

so genius script :appl: thanks from the heart, highend :D
yusef88
 
Posts: 199
Joined: 28 Jan 2013 03:50


Return to Script Exchange



Who is online

Users browsing this forum: No registered users and 2 guests