another quiz: filter challenge
another quiz: filter challenge
This thread was originally posted in the xplorer² Professional forum.
Moved here 19-May-2010 =fg=
=====================================================
a filter/selection challenge.
In xplorer², find and select:
all files in a folder having extension .abc and/or .def
for which there is no .xyz file with the same base name.
Background: the need arises after culling digital camera files.
Having already removed the .jpg versions of many photos, I now want to efficiently find and remove the related .CR2 and .XMP files.
I have yet to find a solution I like.
Moved here 19-May-2010 =fg=
=====================================================
a filter/selection challenge.
In xplorer², find and select:
all files in a folder having extension .abc and/or .def
for which there is no .xyz file with the same base name.
Background: the need arises after culling digital camera files.
Having already removed the .jpg versions of many photos, I now want to efficiently find and remove the related .CR2 and .XMP files.
I have yet to find a solution I like.
Last edited by fgagnon on 2010 May 19, 19:30, edited 1 time in total.
-
- Silver Member
- Posts: 281
- Joined: 2006 Dec 29, 12:56
- Location: Utrecht, NL
Hi Fred,
What about this one. Select all files in the folder. Go to the Script wizard (ctrl+b), and enter
This will make folders named after the plain name of the files, and then puts the file into this folder.
Now "select columns" (Alt+k), and add "Contents [S]" to the set of columns. Folders with a .xyz file in it will have a 3 in this column, the others a 2. Sort on this column, and remove the folder with a 2.
Now select all folders, flatten them, and move all files to the original folder. Remove all previously created folders. (the 'create folders' part actually was inspired by BRX answer to the other challenge a few days ago )
What about this one. Select all files in the folder. Go to the Script wizard (ctrl+b), and enter
Code: Select all
md "$B",move "$F" "$B\"
Now "select columns" (Alt+k), and add "Contents [S]" to the set of columns. Folders with a .xyz file in it will have a 3 in this column, the others a 2. Sort on this column, and remove the folder with a 2.
Now select all folders, flatten them, and move all files to the original folder. Remove all previously created folders. (the 'create folders' part actually was inspired by BRX answer to the other challenge a few days ago )
-
- Silver Member
- Posts: 281
- Joined: 2006 Dec 29, 12:56
- Location: Utrecht, NL
Or, much easier, just select all *.xyz files (by sroting or filtering on extension) and move them all to a empty folder that you have opened in the opposite pane.
Now select all *.xyz in that particular folder, and go to the script wizard, and enter:
press execute (DOS), and all files with the same base name as the *.xyz will be moved from the old folder into the folder with the *xyz files. Remove the remaining *.abc and *.def files.
Now select all *.xyz in that particular folder, and go to the script wizard, and enter:
Code: Select all
move "$I\$B.*" "$P\"
Hi,
+ *.abc,*.def
$ FOR %i IN ($S) DO @if not exist %~ni.xyz echo %~fi
Finally select and copy all names from console2 and put them into a scrap container via insert clipboard.
It would be nice here to have an external x2-tool putscrap.exe which reads filenames from stdin and put them in a new scrap, so that:
$ FOR %i IN ($S) DO @if not exist %~ni.xyz echo %~fi | putscrap
would work.
cu, Bernd
+ *.abc,*.def
$ FOR %i IN ($S) DO @if not exist %~ni.xyz echo %~fi
Finally select and copy all names from console2 and put them into a scrap container via insert clipboard.
It would be nice here to have an external x2-tool putscrap.exe which reads filenames from stdin and put them in a new scrap, so that:
$ FOR %i IN ($S) DO @if not exist %~ni.xyz echo %~fi | putscrap
would work.
cu, Bernd
Nice trick! example such as these show the true potential of command script wizard which I have only used in few instances. I will definitely give it a shot next time when I face similar complex file org situation.Mr.Pleasant wrote:Or, much easier, just select all *.xyz files (by sroting or filtering on extension) and move them all to a empty folder that you have opened in the opposite pane.
Now select all *.xyz in that particular folder, and go to the script wizard, and enter:press execute (DOS), and all files with the same base name as the *.xyz will be moved from the old folder into the folder with the *xyz files. Remove the remaining *.abc and *.def files.Code: Select all
move "$I\$B.*" "$P"
Help! I'm an AI running around in someone's universe simulator.
I like these challenges.
It's good to show of the possibilities of x2, especially of such things like the batch assistant, comparing etc. which probably very few use to their potentials.
I like the solutions so far. Here's another one just for the sake of competition:
Flatten the folder with the files to scrap. Select/Filter files with .abc, hardlink (Ctrl-C/Ctrl H) into a newly created folder, repeat with .def.
Mass rename the hardlinked files with $B.xyz. Send them with Ctrl-S to scrap (two-paned, the other one), Compare with Ctrl-F9, revert selection with NUM *, delete selected.
Sounds more complicated as it is. I prefer hardlinking because speed of copying and hardlinks don't need additional space on harddisk.
It's good to show of the possibilities of x2, especially of such things like the batch assistant, comparing etc. which probably very few use to their potentials.
I like the solutions so far. Here's another one just for the sake of competition:
Flatten the folder with the files to scrap. Select/Filter files with .abc, hardlink (Ctrl-C/Ctrl H) into a newly created folder, repeat with .def.
Mass rename the hardlinked files with $B.xyz. Send them with Ctrl-S to scrap (two-paned, the other one), Compare with Ctrl-F9, revert selection with NUM *, delete selected.
Sounds more complicated as it is. I prefer hardlinking because speed of copying and hardlinks don't need additional space on harddisk.
Last night I tried and liked Mr.Pleasant's 2nd submission (the Or, much easier approach) and I was going to try bst's script this morning, when I saw narayan's solution! :wow:
Not being a programmer, using the Build checker had not entered my (alleged) mind.
This is such an elegant solution. :party:
Thank you, "doctor" narayan!
and especially thank you, nikos, for incorporating a build checker in xplorer² in the first place.
PS - Note that I use only the [Not built] option in the Check build wizard because some of the file dates (the .jpgs in my case) are not necessarily in date order with the other file types.
Not being a programmer, using the Build checker had not entered my (alleged) mind.
This is such an elegant solution. :party:
Thank you, "doctor" narayan!
and especially thank you, nikos, for incorporating a build checker in xplorer² in the first place.
PS - Note that I use only the [Not built] option in the Check build wizard because some of the file dates (the .jpgs in my case) are not necessarily in date order with the other file types.
-
- Silver Member
- Posts: 281
- Joined: 2006 Dec 29, 12:56
- Location: Utrecht, NL
@ We want more challenges! -
Users are welcome to post their own 'challenges' any time.
Indeed, responding to "How do I ...?" questions is a good part of what this forum has always been about. Neither of the two recent "quiz:" threads had solutions that the originators were happy with. It's not that we are trying to initiate a feature on the board -- goodness knows, we are not that organized.
If users like the quiz/challenge idea, I suggest the following guidelines (in an attempt to be uncharacteristically organized).
> Start each challenge in a new topic. (One to a thread.)
> Challenges should be based on a real-world need for which you have either found a clever solution using xplorer², or for which you are not satisfied with the way you currently work it.
> If you have a clever solution, don't post it until after users come up with their own -- you might find something better by not 'leading' readers down your path. :sneaky:
> Be creative, have fun, learn. :D
Users are welcome to post their own 'challenges' any time.
Indeed, responding to "How do I ...?" questions is a good part of what this forum has always been about. Neither of the two recent "quiz:" threads had solutions that the originators were happy with. It's not that we are trying to initiate a feature on the board -- goodness knows, we are not that organized.
If users like the quiz/challenge idea, I suggest the following guidelines (in an attempt to be uncharacteristically organized).
> Start each challenge in a new topic. (One to a thread.)
> Challenges should be based on a real-world need for which you have either found a clever solution using xplorer², or for which you are not satisfied with the way you currently work it.
> If you have a clever solution, don't post it until after users come up with their own -- you might find something better by not 'leading' readers down your path. :sneaky:
> Be creative, have fun, learn. :D
stereobit wrote:@BRX: Your solution is exactly what i needed - unfortunately nearly two years ago. I never asked here for a solution, cause I never thought that's possible with x². It's truly an amazing piece of software.
Agreed. Nice to hear you think my solution is useful. In fact I've used this method or similar ones to solve quite a lot file managing problems I previously considered unsolvable or requiring tedious hour-long manual work.
You aren't by any chance also frequenting the German CCB?
Anyway, the trick to create hardlinks, to work from there with editing, sorting, deleting, comparing and whatever has helped me countless times. I'm nagging Nikos to expand on x2's hardlinking capabilities - to no avail so far, but I won't give up.
Help with "how do I..."
Members,fgagnon wrote:@ We want more challenges! -
Users are welcome to post their own 'challenges' any time.
Indeed, responding to "How do I ...?" questions is a good part of what this forum has always been about... :D
I’m looking for some help with a sort of task which I’m sure must be doable with xp2…
Anyone could point me into the direction?
the scenario:
-- lot of different type of files
-- need to know which sort of extensions I have
-- so not all the files but just one of the extensions
-- in a txt file
Your suggestions would be highly appreciated…
thanx
*** RTC ***
disclaimer
author has just little more as average xp2 knowledge…no heavy programming or whatsoever…just KISS