Sign in to follow this  
Followers 0
SpinningCone

Moving files around

5 posts in this topic

#1 ·  Posted (edited)

OK so I started to clean up my massive MP3 collection which has gotten a bit unruly in the last few years. ive been re-tagging re-naming and organizing but find myself repeating a handful of actions pretty often which i haven't found a program for and figure an autoit script would help

action one is moving file up a directory from sub directories. my file structure is often like this:

[ARTIST]
 |_>[album subfolder]
   |_>[Mp3 files]
   |_>[Mp3 files]
 |_>[album subfolder]
   |_[Mp3 files]
 |_>[album subfolder]

For most people this works well but for my style of listening i really don't care about albums just songs so i have been pulling the files up to the [ARTIST] directory and deleting the empty album sub-directories. after about 2-3 hours of that i am up to the letter "E" :-/

i want to be able to feed the directory to a function, have it find everything in sub folders. move all those files up to the original directory i gave it, keep both files if there are any duplicate names and then delete the empty sub directories. the built in filefindfirstfile() stuff just doesnt seem to cut it. with that I'm not even sure how to tell a file from a directory.

Part 2 would be creating new directories. i have a catch all folder for MP3s that have all the artists and songs mashed together. I have been slowly moving these out to their appropriate artist folder and when not present making a new folder for that artist.

i would like to regex the filename then have the function automatically move the files to the appropriate folder or create that folder.

any suggestions on how to go about doing this would be great. i think i could hack it if i could tell the difference froma folder and a file when i search.

Edited by SpinningCone

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Some of the functions you will want to use:

DirCreate

DirCopy

FileCopy

_FileListToArray

In fact, in the help file ALL of the Dir, File, and _File functions are very helpful and listed one right after the other. You should be able to accomplish your goals with the those functions.

-Fett

Edit: Figured I'd explain a bit more. What you'll be doing is copying the files to the directory you want them and then deleting the directory (folder) that you don't want.

Edited by fett8802

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites

Some of the functions you will want to use:

DirCreate

DirCopy

FileCopy

_FileListToArray

In fact, in the help file ALL of the Dir, File, and _File functions are very helpful and listed one right after the other. You should be able to accomplish your goals with the those functions.

-Fett

i'd use FileMove() not copy I dont want to make more duplicates then have to delete them. Dir create will help with the second, dir copy isnt very useful since i dont want to copy

_FileListToArray looks better. i think i can work with that since it can return folders only.

Share this post


Link to post
Share on other sites

If you want to do a recursive (subdirectory) search for files, you might want to consider using function. It will allow you to search the subdirectories without having to specifically identify them first.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

If you want to do a recursive (subdirectory) search for files, you might want to consider using function. It will allow you to search the subdirectories without having to specifically identify them first.

cool that function helps a lot. got my scripts working. saved me loads of time.

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