|
2019-01-09, 10:55 AM | #1 |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
Help! Creating Folders & Moving Files
I've got roughly 1800 movie files in a folder on the server named like this:
2BTB_061209_Cindy.mp4 2BTB_061211_Mia.mp4 2BTB_061219_Aaliyah.mp4 What I need to do is put them in a folder named the same as their filename, so I'll have: 2BTB_061209_Cindy/2BTB_061209_Cindy.mp4 2BTB_061211_Mia/2BTB_061211_Mia.mp4 2BTB_061219_Aaliyah/2BTB_061219_Aaliyah.mp4 So I copy the file name, create a new folder & name it after the file, then drag the file into the new folder. I can't think of a faster way to do this, but maybe one of you can... |
2019-01-09, 12:43 PM | #2 |
Certified Nice Person
|
Try the free version of FiletoFolder. https://www.thecodeline.com/products...-feature-list/
Install it, then close it. Then, when your right click on a file, the context menu should have the FiletoFolder option. It will automatically create a folder of the same name and place the file inside.
__________________
Click here to purchase a bridge I'm selling. |
2019-01-09, 03:37 PM | #3 | |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
Quote:
|
|
2019-01-09, 04:16 PM | #4 |
Certified Nice Person
|
Shit. I missed that part. It can be done in PHP, but I don't have those sort of skills. (I'm almost strictly a database interaction guy) CD34 could have created a script in 3 and half minutes while eating Arby's.
__________________
Click here to purchase a bridge I'm selling. |
2019-01-10, 05:44 PM | #5 | ||
Me fail English? That's unpossible!
|
Here is a PHP script to automate it:
Code:
<?php $path = "."; $extensions = array( "mp4" ); $files = array_diff(scandir($path), array('.', '..')); foreach ( $files as $file ) { if ( ! is_file ( $file ) ) continue; $file_parts = pathinfo( $file ); if ( ! in_array( $file_parts['extension'], $extensions ) ) continue; if ( ! file_exists( $file_parts['filename'] ) && ! mkdir( $file_parts['filename'] ) ) { echo "Oops! Could not create directory {$file_parts['filename']}\n"; continue; } $new_loc = $file_parts['filename'] . "/" . $file; if ( ! file_exists( $new_loc ) && ! rename( $file, $new_loc ) ) { echo "Oops! Could not move {$file} to {$ new_loc}\n"; continue; } echo $file . " moved to {$new_loc} successfully.\n"; } Before: Quote:
After: Quote:
|
||
2019-01-11, 07:23 AM | #6 |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
OMFG!!!
OK, so I save the code* as greenguy_help.php then upload it to the server and then how do I run it? (I'm not tech savvy lol) Just go to it in a browser? "Execute" it via FTP? *Is there supposed to be a ?> at the end of the code? PS - If this works, Ramster will need your Paypal |
2019-01-11, 08:10 AM | #7 | |
Life is good
|
Quote:
Talk on Skype, if Skype actually updates you |
|
2019-01-11, 08:29 AM | #8 |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
I'd run shit on your servers no problem
|
2019-01-11, 08:47 AM | #9 | |
Me fail English? That's unpossible!
|
Quote:
It's optional. |
|
2019-01-11, 08:58 AM | #10 |
Certified Nice Person
|
I just tested it and works smoothly.
Vbulletin put two line breaks in when Howling pasted the code into the code thing. Note that the extension part is case sensitive. ------------------------------------------------------------------ <?php $path = "."; $extensions = array( "mp4" ); $files = array_diff(scandir($path), array('.', '..')); foreach ( $files as $file ) { if ( ! is_file ( $file ) ) continue; $file_parts = pathinfo( $file ); if ( ! in_array( $file_parts['extension'], $extensions ) ) continue; if ( ! file_exists( $file_parts['filename'] ) && ! mkdir( $file_parts['filename'] ) ) { echo "Oops! Could not create directory {$file_parts['filename']}\n"; continue; } $new_loc = $file_parts['filename'] . "/" . $file; if ( ! file_exists( $new_loc ) && ! rename( $file, $new_loc ) ) { echo "Oops! Could not move {$file} to {$new_loc}\n"; continue; } echo $file . " moved to {$new_loc} successfully.\n"; } ?> -----------------------
__________________
Click here to purchase a bridge I'm selling. |
2019-01-11, 09:00 AM | #11 | |
Certified Nice Person
|
If you're scared, change the "mp4" to "jpg" in a folder of test images on your server, then go to the address of this php file in your browser. It won't hurt anything.
Quote:
__________________
Click here to purchase a bridge I'm selling. |
|
2019-01-11, 09:09 AM | #12 |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
YOU GUYS ROCK!!!
If it was on mine or Ramster's server, I'd run it myself, but like Ramster said, it's a client's server, so we'll have the host do it. |
2019-01-11, 09:41 AM | #13 |
Certified Nice Person
|
#pussy
__________________
Click here to purchase a bridge I'm selling. |
2019-01-12, 03:43 PM | #14 |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
1 - Worked PERFECTLY!
2 - Is it by any chance easy to go from this: 2BTB_061209_Cindy.mp4 2BTB_061211_Mia.mp4 2BTB_061219_Aaliyah.mp4 To this: 2BTB_061209_Cindy/source/2BTB_061209_Cindy.mp4 2BTB_061211_Mia/source/2BTB_061211_Mia.mp4 2BTB_061219_Aaliyah/source/2BTB_061219_Aaliyah.mp4 |
2019-01-12, 05:47 PM | #15 | |
Me fail English? That's unpossible!
|
Quote:
PHP Code:
|
|
2019-01-13, 08:33 AM | #16 |
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
|
Ramster & I to you!
|
|
|