Moving files into folders
Moderators: fgagnon, nikos, Site Mods
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Moving files into folders
I am using v2.5.0.4 still because I didn't see the need to upgrade to v3.0.
I have a folder filled with 100's of files and need to create a separate folder for each individual file. That would take too long on a one-by-one basis. I know a program called 'File 2 Folder' that can do this in a single click but when I installed it my antivirus blocked the installation claiming it contained malware. x2 is so customizable that I was wondering if there is some way I can make x2 achieve the same task, and if so, how?
If x2 cannot do it, does anyone know of any other stand alone programs that can achieve this please?
I have a folder filled with 100's of files and need to create a separate folder for each individual file. That would take too long on a one-by-one basis. I know a program called 'File 2 Folder' that can do this in a single click but when I installed it my antivirus blocked the installation claiming it contained malware. x2 is so customizable that I was wondering if there is some way I can make x2 achieve the same task, and if so, how?
If x2 cannot do it, does anyone know of any other stand alone programs that can achieve this please?
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
Update: I found a snippet of code that you can save as a text file and once saved, convert to a .bat extension.
@echo off
for %%a in (*.*) do (
md "%%~na" 2>nul
move "%%a" "%%~na"
)
Copy that script to the folder where you want to move all your files and run it. It took 4 seconds to process over 200 files.
A guy on the same forum claims it doesn't work with ISO files so he created another script that does. If anyone is interested in that, here it is:
@echo off
for %%a in (*.iso) do (
md “%%~na” 2>nul
move “%%a” “%%~na”
move “%%~na.jpg” “%%~na”
move “%%~na.file.jpg” “%%~na”
move “%%~na.dvdid.xml” “%%~na”
move “%%~na.mymovies.xml” “%%~na”
move “%%~na.mymovies-back.jpg” “%%~na”
move “%%~na.mymovies-front.jpg” “%%~na”
)
I would still like to know if there is anyway I can use this script code to create a custom option for doing that within x2?
Incidentally, I also found an application called File to Folder that does the same thing but also has an undo option. It costs $14.99 though. While that isn't exactly expensive, the guy who wrote the batch script above offers his own GUI version that does even more as freeware (download from the Google Code site at http://code.google.com/p/file2foldergui/).
@echo off
for %%a in (*.*) do (
md "%%~na" 2>nul
move "%%a" "%%~na"
)
Copy that script to the folder where you want to move all your files and run it. It took 4 seconds to process over 200 files.
A guy on the same forum claims it doesn't work with ISO files so he created another script that does. If anyone is interested in that, here it is:
@echo off
for %%a in (*.iso) do (
md “%%~na” 2>nul
move “%%a” “%%~na”
move “%%~na.jpg” “%%~na”
move “%%~na.file.jpg” “%%~na”
move “%%~na.dvdid.xml” “%%~na”
move “%%~na.mymovies.xml” “%%~na”
move “%%~na.mymovies-back.jpg” “%%~na”
move “%%~na.mymovies-front.jpg” “%%~na”
)
I would still like to know if there is anyway I can use this script code to create a custom option for doing that within x2?
Incidentally, I also found an application called File to Folder that does the same thing but also has an undo option. It costs $14.99 though. While that isn't exactly expensive, the guy who wrote the batch script above offers his own GUI version that does even more as freeware (download from the Google Code site at http://code.google.com/p/file2foldergui/).
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
you can do this thing using xplorer2 batch file creator (CTRL+B), something like
mkdir "f_$N", move "$N" "f_$N"
for more information see the quickstart guide
obviously the folder name cannot be the same as the file name
at first it's best to experiment with a small selection of test files
mkdir "f_$N", move "$N" "f_$N"
for more information see the quickstart guide
obviously the folder name cannot be the same as the file name
at first it's best to experiment with a small selection of test files
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
Ctrl + B doesn't do anything. I can see it listed as Command Script under the Tools menu but that option is greyed out. Perhaps there is something I need to do in the Advanced settings to activate it?nikos wrote:you can do this thing using xplorer2 batch file creator (CTRL+B), something like
mkdir "f_$N", move "$N" "f_$N"
Why obviously? They have to be the same ad that's exactly what the script I posted does.obviously the folder name cannot be the same as the file name
Is it not possible to use that script as a custom command because I already know it works?
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
ctrl+B assumes you must first select the items you want to operate upon, either one or all the visible items
if you want the folder name to be the same with the mini=script I gave you, you have to add a third step that renames the f_$N into $N
if you want the folder name to be the same with the mini=script I gave you, you have to add a third step that renames the f_$N into $N
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
So what would the full script be? It's best I just copy & paste to avoid any errors.
If I understand you correctly, there is no option for making this mini-script as a custom command so I can just select it whenever needed?
Also, are the quotation marks really needed because there are none in the examples provided?
If I understand you correctly, there is no option for making this mini-script as a custom command so I can just select it whenever needed?
Also, are the quotation marks really needed because there are none in the examples provided?
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
Code: Select all
mkdir "f_$N", move "$N" "f_$N", ren "f_$N" "$N"for explanation of $N etc please see the quickstart guide
this must be executed as DOS script
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
Executed as DOS script it works on both single and multiple files. The only problem is that it retains the extension. For example, the folder name ends in .mp4 or .mkv. Is it possible to make the folder take just the filename without its extension? Also, can the script be saved so that it can be used from either a custom command or a preconfigured script? I regret I'm having trouble understanding the quickstart guide. I'm probably too old.
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
in that case use this variant to skip the extensions
Code: Select all
mkdir "f_$B", move "$N" "f_$B", ren "f_$B" "$B"-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
Thanks Nikos. That works.
However, I keep asking if this code can be saved and used as a custom command but for reasons unknown to me you never reply to that?
However, I keep asking if this code can be saved and used as a custom command but for reasons unknown to me you never reply to that?
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
this "command" is saved in the batch file creation history, you will find it under the TEMPLATE combo box where you first typed it
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
Thanks Nikos. Is it not possible to give the template a name so I can identify it?
As it stands it is just a line of code in the template field so not much use, especially if you have several templates.
As it stands it is just a line of code in the template field so not much use, especially if you have several templates.
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
that's all you can do with it
-
QT-Pro
- Silver Member

- Posts: 176
- Joined: 2007 Jul 12, 15:55
Re: Moving files into folders
Is it any different in v3 Ultimate?
-
nikos
- Site Admin

- Posts: 16402
- Joined: 2002 Feb 07, 15:57
- Location: UK
Re: Moving files into folders
no, it's the same 