Sign in to follow this  
Followers 0
Merle

Merging files/folder with similar name

6 posts in this topic

Extreme NEWB :"> here:

Merging files/folder with similar name

I have a folder that has a lot of files (pdf and txt and html) that are very similar.

For example I have:

c:\recipes

in the recipes folder I have files all about apples

some may be named "apple, pie - best home made.txt"

the next named "apple, pie - secret of the best.pdf"

I would like to have it look at the first word, second word and then create a folder called apple, pie and then merge them into apple, pie folder. If there is a folder already made called "apple, pie - recipes of the best" I would also like it to move it into the root folder of "apple, pie"

Then if it comes to the next recipe named "cherry, pie - best home made.txt"

and the next named "cherry, pie - secret of the best.pdf"

to once again have it : look at the first word, second word and then create a folder called cherry, pie and then merge them into cherry, pie folder. if there is a folder already made called "cherry, pie - recipes of the best" I would also like it to move it into the root folder of "cherry, pie"

and of course if finds a dupe that it just over right the file\folder

Thanks ever so much.

Merle

Share this post


Link to post
Share on other sites



Extreme NEWB :"> here:

Merging files/folder with similar name

I have a folder that has a lot of files (pdf and txt and html) that are very similar.

For example I have:

c:\recipes

in the recipes folder I have files all about apples

some may be named "apple, pie - best home made.txt"

the next named "apple, pie - secret of the best.pdf"

I would like to have it look at the first word, second word and then create a folder called apple, pie and then merge them into apple, pie folder. If there is a folder already made called "apple, pie - recipes of the best" I would also like it to move it into the root folder of "apple, pie"

Then if it comes to the next recipe named "cherry, pie - best home made.txt"

and the next named "cherry, pie - secret of the best.pdf"

to once again have it : look at the first word, second word and then create a folder called cherry, pie and then merge them into cherry, pie folder. if there is a folder already made called "cherry, pie - recipes of the best" I would also like it to move it into the root folder of "cherry, pie"

and of course if finds a dupe that it just over right the file\folder

Thanks ever so much.

Merle

That's great... was there a question here?

Have you attempted anything... If you have where is it?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

That's great... was there a question here?

Have you attempted anything... If you have where is it?

Hi I have but like I said I am extremely new at this. I thought I would try the basic part first of using the dos command search function. Just to get me started down the path this is where I am at. I need the next line and I am not sure of even how to have it read in the listing of the files in the dir. It took forever for me to figure out how to do a phrase that would let google find out how to send a quotation mark in a send command. Yeah I know what I want it to do :) I am trying to learn how to make it do it.

If IsAdmin() Then

Run(@ComSpec & " /c " & "sc create testsvc binpath= ""cmd /K start"" type= own type= interact", "", @SW_HIDE)

Run(@ComSpec & " /c " & "sc start testsvc", "", @SW_HIDE)

Sleep(1000)

Run(@ComSpec & " /c " & "sc delete testsvc", "", @SW_HIDE)

Else

MsgBox(16,"Error","You do not have administrator priviledges on the local machine.")

EndIf

WinWaitActive("C:\WINDOWS\system32\cmd.exe")

Send("cd C:\recipes{ENTER}")

send("dir C:\recipes\apple\")

Send("/s /b |")

Send("find "& chr(34) & "apple, pie" & chr(34)& " ")

#ceSend("find "& chr(34) & "apple, pie" & chr(34)& " ")

send("{ENTER}")

Thanks for responding so quickly already!

Merle

Share this post


Link to post
Share on other sites

Look at

While/WEnd + FileFindFirstFile + FileFindNextFile

Or

_FileListToArray()

These can be found in the help file, that way you can list the files you are looking for, in a loop, then your String* functions to help you parse the info you are looking for.

What are the "Send"(s) for?.... ahh sending the info to cmd.exe I see.

_FileListToArray() is probably your best bet here.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Look at

While/WEnd + FileFindFirstFile + FileFindNextFile

Or

_FileListToArray()

These can be found in the help file, that way you can list the files you are looking for, in a loop, then your String* functions to help you parse the info you are looking for.

What are the "Send"(s) for?.... ahh sending the info to cmd.exe I see.

_FileListToArray() is probably your best bet here.

Not trying to be stupid nor lazy but could you show me how I would do that? I am basically at the hand holding stage here. i can figure out how to go to the dir but need more help.

If I had an example of how to have it read in the names of the files from

c:\my recipes

then what?

Sorry to be stupid I don't know how to program.

once again thanks SmOke_N for posting back to the response earlier.

Merle

Share this post


Link to post
Share on other sites

Not trying to be stupid nor lazy but could you show me how I would do that? I am basically at the hand holding stage here. i can figure out how to go to the dir but need more help.

If I had an example of how to have it read in the names of the files from

c:\my recipes

then what?

Sorry to be stupid I don't know how to program.

once again thanks SmOke_N for posting back to the response earlier.

Merle

Not much on hand holding (anymore*), but I will say this, there are exact answers you are looking for in the examples of the help file for what I listed.

Some other things to note you'll need are StringInStr() / StringReplace() and a basic understanding of variables and or arrays.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0