need help creating folders based strings from files' names and moving the files inside

Advanced Renamer forum
#1 : 25/01-11 03:13
Mihai
Mihai
Posts: 2
Hi,

At the moment I'm downloading server logs locally inside a common folder, in order to archive them and store them on backup media.

However, I don't like the fact that they aren't organized in a tidy way and doing it manually is quite time consuming.


The logs that I have are in this format:

domainname.com.20100821.gz
domainname.com.20100822.gz
domainname.com.20100823.gz

etc.


some domains have hyphens like this:

domain-name.com.20100821.gz
domain-name.com.20100822.gz
domain-name.com.20100823.gz

etc.


What I need is:

1) the tool to extract the domain name from the file names, which is "domainname" or "domain-name" and to create a folder with that string, unless the folder already exists;

2) the tool to extract the year (2010) and to create a folder with the same name under the folder of the domain name (handled at step 1. above), again unless it exists;

3) the tool to extract also the month (08) and to create a folder with the format "year-month" (2010-08) under the folder of the year (handled at step 2 above);

4) finally to move the file to the folder created as step 3 above.


In other words, I want a file like:

domainname.com.20100821.gz


To be moved to:

domainname.com/2010/2010-08/domainname.com.20100821.gz


Or a file like:

domain-name.com.20100821.gz


To be moved to:

domain-name.com/2010/2010-08/domain-name.com.20100821.gz


Your help on making this possible with Advanced Renamer would be highly appreciated.

Thanks,
Mihai


25/01-11 03:13
#2 : 26/01-11 18:58
Kim Jensen
Kim Jensen
Administrator
Posts: 756
Reply to #1:
I am planning a copy and move mode in Advanced Renamer. Your case is very valid and detailed enough for me to work with. It is easier for me to develop such a feature when I have a specific case like yours to work with. I hope to be able to release a public beta with the copy and move mode within a couple of weeks.


26/01-11 18:58
#3 : 29/01-11 20:22
Mihai
Mihai
Posts: 2
Reply to #2:
That would be fantastic Kim!

Thank you,
Mihai


29/01-11 20:22
#4 : 28/02-11 21:09
Kim Jensen
Kim Jensen
Administrator
Posts: 756
Reply to #3:
You can test out the new copy and move functionality in the beta 2 of Advanced Renamer found in the download section. I told you that I would design the software to solve your problem. I realize now that it cannot solve the problem 100%. But don't worry. I have a couple of ideas to what I can do to solve the problem. I just need a few days. I promise that the final version will be able to help you.

This is what Advanced Renamer can do to help you so far:
See the screenshot found here: http://www.advancedrenamer.com/img/forumimg/fol dercreation_for_domains.gif

1. I have used copy mode but if you prefer mode move, you can use that intead. Mode is set above the list of files.
2. I have set the output folder to c:\Users\Kim\Temp\testoutput\<substr:1:.2>\2<substr:.2:3>. The c:\Users\Kim\Temp\testoutput is a static folder on my computer. That part will of course be different on your computer. Advanced Renamer will automatically create any non existing folder.
3. Added one method, the New Name method and set the pattern to <Name>.<Ext>

The problem now is that I could not instruct Advanced Renamer to locate the month in the filename. There is now way of finding it with the substr tag right now. That is the problem I am going to fix in the final version. Other tags might also be useful to express the new path of the files. I will let specific problems dictate which tags are needed instead of trying to predict the upcoming needs.



28/02-11 21:09
#5 : 05/03-11 21:42
Kim Jensen
Kim Jensen
Administrator
Posts: 756
With the release of version 3.0 you can accomplish what you want. Do as above but use the following folder pattern instead:

C:\Users\Kim\Temp\testoutput\<substr:1:.2>\<rsubstr:5:4>\<rsubstr:5:4>-<rsubstr:3:2>

Also see this screenshot:
http://www.advancedrenamer.com/img/forumimg/fol dercreation_for_domains2.gif


05/03-11 21:42
#6 : 29/11-13 06:59
Allen Jackson
Allen Jackson
Posts: 1
Reply to #5:

This is extremely impressive. Just renamed 9,955 files into new directories (maybe lift limit of 10,000?).

Well done. Thanks!!


29/11-13 06:59
#7 : 26/09-14 06:21
Matthew Randolph
Matthew Randolph
Posts: 1
Reply to #4:
Thank You for such a robust and easy to product. I have a question along the lines of the original poster. Where he is using part of the file names as folder names, in my work place we do it a little differently. Part of the file name is also part of the folder name. For example:


c:\Install Paperwork\Install Field Service Ticket - 14336 J.pdf


c:\Filecenter\2014\14336 Lancaster\


Is it possible to have AdvancedRenamer to copy the pdf file into the folder 14336 Lancaster based solely off of the characters "14336"?

Thanks for any and all help!!


26/09-14 06:21
#8 : 19/02-16 04:09
archie
archie
Posts: 1
i have bumped into this renamer yesterday and made a tutorial

http://thattool.blogspot.ae/2016/02/move-files- based-on-its-filename.html


19/02-16 04:09
#9 : 19/02-16 20:23
Kim Jensen
Kim Jensen
Administrator
Posts: 756
Reply to #8:
Great tutorial. Good work. I like when other people write tutorials for the program. Because I know too much about the program and how the internals work, my writings about the program are not always good enough.


19/02-16 20:23 - edited 19/02-16 20:24