INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: How do I search for thousands of folders/files based on a list?  (Read 3431 times)

JustinChase

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3276
  • Getting older every day

I have a project I need to do which involves finding tens of thousands of files in thousands of folders, renaming them based on certain criteria, then moving them to a new location.

However, the files and folders I need are among even more folders, and I don't want to/can't move all of them, only the specific subset.

How can I use MC to find/select only the ones I want within the full list/set?.  I have tried copying some information from the files into the keywords, as I can do a keyword search, and this works.  However, I can only search for 25 or 30 keywords at a time (maybe it's more, but not nearly enough).  I have tried searching other fields with a list, but nothing does what I want.

specifically, the folders are named with the convention    name.number

the number is (should be) always 10 digits.  I created a new library field that extracts this 10 digit number from the folder name.  this is what I copied into the keywords field, and was able to search by/for. 

The problem is that there will be about 10,000 folders that need to be selected from among about 20,000 folders.  inside those folders are 4 to 15 files each.  it's the files I need to rename, then move.  they don't need to stay in the folders, nor in their original structure once renamed, as they will all go to a new folder and will not need to be kept separate as they are now.

obviously selecting them 25 or 30 folders at a time will not work.

the list of 10 digit numbers will come from excel, but could be in just about any file type if it would help.

can I create a custom field that will allow me to add thousands of numbers in a list and use it to search?

I can provide more details as necessary, but is there anything I can/should try.

any help is REALLY appreciated.

thanks
Logged
pretend this is something funny

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: How do I search for thousands of folders/files based on a list?
« Reply #1 on: March 20, 2010, 01:17:24 pm »

Your description of the problem is not perfectly clear, but I suppose I can deduce this: If you could select the files you want to rename based on their existing tags and/or file pathnames, there would be no problem. You would simply select them, and use Rename, Move & Copy Files to rename/move them. So this must not be possible, and the only means of distinguishing these files is that their numbers appear in an external list (an Excel worksheet).

If my understanding is correct, what you need to do is use the list to import a new attribute (i.e., a category/field) to indicate whether a file is in the list. Create a custom field named, say, In My List. Such an import needs to match items based on file pathnames. Those probably aren't available in your list, so you'll need to add them. This can be done by exporting Number and Filename (path) from MC (as a delimited text file) and importing this into Excel. Then use the vlookup function in Excel to add the file pathnames to your list of numbers. Add another column with the title In My List and set all its values to "TRUE."

The next step is to use the resulting Excel worksheet to create an MPL file (a MC XML playlist) that MC can import. Unfortunately, MC cannot import Excel or CSV files directly. Creating an MPL file is a bit tedious, but—thanks to Alex B—the procedure is described in detail in the posts linked to this one.

After importing this file, you will be able to select In My List = TRUE, and then use Rename, Move & Copy Files to rename/move them.

Logged

JustinChase

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3276
  • Getting older every day
Re: How do I search for thousands of folders/files based on a list?
« Reply #2 on: March 20, 2010, 04:01:16 pm »

Thanks for the help.  I will try to make my explanation more clear, in case that makes the solution "easier".

I have a network drive with 20,000 folders, which all contain several files.  (4 to 10 files each)

all of the folders are named   name.number

all of the files have varied names, but this is fine, I can/will rename them  -  I created new library fields called
  • Date - formatting the created date as 01012010
  • Status - a 3 character field I will fill in based on the current file name
  • Number - which extracts the rightmost 10 digits from the folder name

the files get renamed as Date_Status_Number

Okay, so I no longer need certain folders (about 10,000 folders, so about 60,000 files).  in other words if I'm finished with the folder, I need to move all the files it contains.  if I'm not finished with the folder, I won't move any of the files it contains.

i have a list of these "finished" folders, currently an excel list

the only way to get these "finished" folders into MC is to import *all* of the 20k folders on the network

         *is there a way outside of MC to select only these folders and move them, letting me import only this new location into MC??

after creating the library fields, I copied the number into the keyword field

I then created a smartlist where the file is in the correct path, and the keywords contains the list of numbers.  this is where I run into the problem.  The smartlist uses keyword contains, and I can only enter 30ish numbers here.  it works fine, and I can then move the results to a new location, and then enter another 30ish numbers in the smartlist and repeat.  this has worked fine for the proof of concept, but will take WAY too long to select 10,000 folders worth of files.

my hope is that there is a way to use a much longer list in my smartlist to select all the files in my list at once, or in MUCH larger groups

is the keyword field limited to 30ish numbers or a certain number of characters; are all fields similarly limited, or will something other than keyword let me enter more numbers?

I hope that clears up my needs a bit more.  sorry, it's not so easy to explain in writing :(

I think I understand your suggestion, and I think I can save many steps, as I can get the correct path into the excel sheet directly (avoiding the export and vlookup).

the trick is the next step, which you link to, provided by Alex, and I will review that next.

however, either selecting them using my list and moving them outside of MC, or getting a smartlist to allow more arguments (bigger list) might be easier.  anyone know if that is possible?

Logged
pretend this is something funny

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: How do I search for thousands of folders/files based on a list?
« Reply #3 on: March 20, 2010, 04:06:46 pm »

I hope that clears up my needs a bit more.  sorry, it's not so easy to explain in writing :(
So the problem in a nutshell is you need to pick 10k out of 20k folders based on specific criteria. This criteria is 10k items long so the keyword approach is not practical. The problem here is each criteria by itself returns just one folder and is unique.

The tirck is to get the list of the desired folders, once thats done then you can apply MC's rules to move/rename as appropriate.

How'm I doing :)
Logged

JustinChase

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3276
  • Getting older every day
Re: How do I search for thousands of folders/files based on a list?
« Reply #4 on: March 20, 2010, 04:19:13 pm »

Okay, I'm not at work to test, but I think I have a new idea/plan...

I tested and it seems I can enter an unlimited number of actual keywords into one files tag (at least 2050 of them is what I tested), and I can enter them as semi-colon delimited numbers with just one paste.  I can copy from excel into word, replace paragraph marks with semi-colons and get one long list of my numbers.

I then paste that list into the keyword field in a dummy/donor file in MC, which then creates a list of those keywords to choose from in my smartlist.  I just select does *not* contain empty (I couldn't find a way to select multiple check boxes in the dropdown) and i get a list of all the files that contain one/any of those numbers in the keyword field.

I only tested with one file, as I don't have the list or the network access right now to test in full, but I'm hopeful this will work.

I guess I'll find out more on Monday.

that's not to say there's not a better way, and I'm all for any more help or suggestions in the meantime.
Logged
pretend this is something funny

JustinChase

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3276
  • Getting older every day
Re: How do I search for thousands of folders/files based on a list?
« Reply #5 on: March 20, 2010, 04:21:04 pm »

So the problem in a nutshell is you need to pick 10k out of 20k folders based on specific criteria. This criteria is 10k items long so the keyword approach is not practical. The problem here is each criteria by itself returns just one folder and is unique.

The tirck is to get the list of the desired folders, once thats done then you can apply MC's rules to move/rename as appropriate.

How'm I doing :)

Pretty much, yes.  the trick is the hard part, but I might have gotten it while you were typing.

thanks, and I'll reply once I have had a chance to test.
Logged
pretend this is something funny

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: How do I search for thousands of folders/files based on a list?
« Reply #6 on: March 20, 2010, 04:52:46 pm »

Quote
The trick is to get the list of the desired folders, once thats done then you can apply MC's rules to move/rename as appropriate.

Isn't that what I said? ;)

Quote
I only tested with one file, as I don't have the list or the network access right now to test in full, but I'm hopeful this will work.

Interesting idea. I never thought about it before, but I suppose the program needs to be able to handle as many criteria values as it can handle in number of files. If there's a limit to the number you can copy to the clipboard or assign to one file, that's still not going to stop the method from working.

Another method would be to move the target directories to a different root, and then import them separately (or use the directory root to distinguish them). This could be done using your Excel to create a batch file that moves only the target directories.
Logged

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: How do I search for thousands of folders/files based on a list?
« Reply #7 on: March 20, 2010, 05:35:50 pm »

I then paste that list into the keyword field in a dummy/donor file in MC, which then creates a list of those keywords to choose from in my smartlist.  I just select does *not* contain empty (I couldn't find a way to select multiple check boxes in the dropdown) and i get a list of all the files that contain one/any of those numbers in the keyword field.
Thing here is it will just find all files where which don't have that value. But every file has a value.

I think what you want to do instead is here
Logged

JustinChase

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3276
  • Getting older every day
Re: How do I search for thousands of folders/files based on a list?
« Reply #8 on: March 21, 2010, 09:37:46 am »

Another method would be to move the target directories to a different root, and then import them separately (or use the directory root to distinguish them). This could be done using your Excel to create a batch file that moves only the target directories.

again, this is the trick, how to move only some of them, inside or outside MC; the hard part is how to select only some of many to move them?

Thing here is it will just find all files where which don't have that value. But every file has a value.

I think what you want to do instead is here

yes, every file will have *a* value, but it should only find those that are *not* the 10,000 ones I need to move into the dummy file.  I can tag the ones it finds as "keep" and the rest could be found with a second smartlis; "does not equal keep"

if there is a way to select multiple checkboxes in the smartlist window quickly, it would save me having to do the second smartlist.

unfortunately I can't test until tomorrow, but if my plan doesn't work, I'll try your suggestion of include all and see if that works.

the next problem will be the fact that I'm sure in 20,000 attempts, people have mis-entered the 10 digit number, so I'll end up with false positives (or negatives) and that will certainly create a problem of it's own :)

joy joy

thanks again for the help!
Logged
pretend this is something funny

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: How do I search for thousands of folders/files based on a list?
« Reply #9 on: March 21, 2010, 12:16:44 pm »

Quote
again, this is the trick, how to move only some of them, inside or outside MC; the hard part is how to select only some of many to move them?

You said the files are in folders named [name.number] and you have a worksheet with the target [number]s. If you don't already have [name] in the worksheet, you would have to get that (it could be looked-up from a directory listing). Then, for each [number] in the worksheet, create the command...

MOVE "\root\[name].[number]" "\new root\[name].[number]"
Logged

JustinChase

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3276
  • Getting older every day
Re: How do I search for thousands of folders/files based on a list?
« Reply #10 on: March 22, 2010, 08:31:46 am »

thanks.  I can add the name to my list easy enough, but how do I do that command for 10,000 files at once?  It'll take way too long to do it one at a time :)
Logged
pretend this is something funny

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: How do I search for thousands of folders/files based on a list?
« Reply #11 on: March 22, 2010, 09:50:18 am »

This could be done using your Excel worksheet to create a batch file that moves only the target directories.
Logged

gappie

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 4580
Re: How do I search for thousands of folders/files based on a list?
« Reply #12 on: March 22, 2010, 10:33:20 am »

one way to do it might be importing the filenames from excell as a playlist?
when you make a small test playlist and export it as a m3u (simple) playlist, and you open it with notepad you can see that its just a list with the files (fullpath).
when you can get all the fullpath filenames in a playlist the same way, and import the playlist in mc, you have the list from the files that have to be renamed. (you find the imported playlist under 'imported playlists'..

not sure.. but it could work.

 :)
gab

edit: i just did a small test. when importing a m3u file, the text items are not imported, but when dropping the playlist from explorer in the playlists tree from mc it does. but only fro the files that are imported.
Logged

rick.ca

  • Citizen of the Universe
  • *****
  • Posts: 3729
Re: How do I search for thousands of folders/files based on a list?
« Reply #13 on: March 22, 2010, 11:18:39 am »

Quote
one way to do it might be importing the filenames from excell as a playlist?

Oops. I should have thought of this. All he needs to do (if I understand correctly) is identify those files in MC that are in the list—not import any data. This, of course, is exactly what a simple playlist does.
Logged
Pages: [1]   Go Up