Greenguy's Board


Go Back   Greenguy's Board > General Business Knowledge
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2019-01-09, 10:55 AM   #1
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
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...
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Old 2019-01-09, 12:43 PM   #2
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
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.
Useless is offline   Reply With Quote
Old 2019-01-09, 03:37 PM   #3
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
Quote:
Originally Posted by Useless Warrior View Post
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.
That does look handy, but these are on the server so I'm doing everything via FTP.
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Old 2019-01-09, 04:16 PM   #4
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
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.
Useless is offline   Reply With Quote
Old 2019-01-10, 05:44 PM   #5
HowlingWulf
Me fail English? That's unpossible!
 
HowlingWulf's Avatar
 
Join Date: Dec 2003
Location: FL
Posts: 1,381
Send a message via ICQ to HowlingWulf
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:
-bash-4.1$ ll
total 4
-rw-rw-r-- 1 admin www-data 0 Jan 10 17:50 2BTB_061209_Cindy.mp4
-rw-rw-r-- 1 admin www-data 0 Jan 10 17:51 2BTB_061211_Mia.mp4
-rw-rw-r-- 1 admin www-data 0 Jan 10 17:51 2BTB_061219_Aaliyah.mp4
-rw-rw-r-- 1 admin www-data 662 Jan 10 17:49 greenguy_help.php

After:
Quote:
-bash-4.1$ php greenguy_help.php
2BTB_061209_Cindy.mp4 moved to 2BTB_061209_Cindy/2BTB_061209_Cindy.mp4 successfully.
2BTB_061211_Mia.mp4 moved to 2BTB_061211_Mia/2BTB_061211_Mia.mp4 successfully.
2BTB_061219_Aaliyah.mp4 moved to 2BTB_061219_Aaliyah/2BTB_061219_Aaliyah.mp4 successfully.
-bash-4.1$ ll
total 16
drwxrwsr-x+ 2 admin www-data 4096 Jan 10 17:51 2BTB_061209_Cindy
drwxrwsr-x+ 2 admin www-data 4096 Jan 10 17:51 2BTB_061211_Mia
drwxrwsr-x+ 2 admin www-data 4096 Jan 10 17:51 2BTB_061219_Aaliyah
-rw-rw-r-- 1 admin www-data 662 Jan 10 17:49 greenguy_help.php
__________________
WordPress Porn directory theme => Maddos
Create a Porn Tube => Video Pornster
HowlingWulf is offline   Reply With Quote
Old 2019-01-11, 07:23 AM   #6
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
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
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Old 2019-01-11, 08:10 AM   #7
Ramster
Life is good
 
Ramster's Avatar
 
Join Date: Apr 2003
Location: Ottawa, Canada
Posts: 11,659
Send a message via ICQ to Ramster Send a message via AIM to Ramster
Quote:
Originally Posted by Greenguy View Post
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
I wouldn't run anything on my servers, or clients. I would just ask the hosting company, NationalNet to do this as they are paid to do it lol

Talk on Skype, if Skype actually updates you
__________________
Pornstar Legends | Live Cam Model Shows | Hungarian Girls
Skype: robmurray999
Ramster is online now   Reply With Quote
Old 2019-01-11, 08:29 AM   #8
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
Quote:
Originally Posted by Ramster View Post
I wouldn't run anything on my servers, or clients. I would just ask the hosting company, NationalNet to do this as they are paid to do it lol
I'd run shit on your servers no problem
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Old 2019-01-11, 08:47 AM   #9
HowlingWulf
Me fail English? That's unpossible!
 
HowlingWulf's Avatar
 
Join Date: Dec 2003
Location: FL
Posts: 1,381
Send a message via ICQ to HowlingWulf
Quote:
Originally Posted by Greenguy View Post
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?
Upload it to the directory your MP4s are in. If you have shell access, run it from the command line. If not you can run it from your browser, though the output messages will be all on one line.

Quote:
Originally Posted by Greenguy View Post
*Is there supposed to be a ?> at the end of the code?
It's optional.
__________________
WordPress Porn directory theme => Maddos
Create a Porn Tube => Video Pornster
HowlingWulf is offline   Reply With Quote
Old 2019-01-11, 08:58 AM   #10
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
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.
Useless is offline   Reply With Quote
Old 2019-01-11, 09:00 AM   #11
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
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:
HCP032001.JPG moved to HCP032001/HCP032001.JPG successfully. HCP032002.JPG moved to HCP032002/HCP032002.JPG successfully. HCP032003.JPG moved to HCP032003/HCP032003.JPG successfully.
In that example, I changed the extension to "JPG" because it is case sensitive.
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2019-01-11, 09:09 AM   #12
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
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.
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Old 2019-01-11, 09:41 AM   #13
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
#pussy
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote
Old 2019-01-12, 03:43 PM   #14
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
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
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Old 2019-01-12, 05:47 PM   #15
HowlingWulf
Me fail English? That's unpossible!
 
HowlingWulf's Avatar
 
Join Date: Dec 2003
Location: FL
Posts: 1,381
Send a message via ICQ to HowlingWulf
Quote:
Originally Posted by Greenguy View Post
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
Sure. Try this:

PHP 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; }

        if ( ! 
file_exists$file_parts['filename'] . "/source" ) && ! mkdir$file_parts['filename'] . "/source" 
) ) { echo "Oops! Could not create directory {$file_parts['filename']}/source\n"; continue; }

        
$new_loc $file_parts['filename'] . "/source/" $file;
        if ( ! 
rename$file$new_loc ) ) { echo "Oops! Could not move {$file} to {$new_loc}\n"; continue; }

        echo 
$file " moved to {$new_loc} successfully.\n";
}

echo 
"Done\n";
__________________
WordPress Porn directory theme => Maddos
Create a Porn Tube => Video Pornster
HowlingWulf is offline   Reply With Quote
Old 2019-01-13, 08:33 AM   #16
Greenguy
The Original Greenguy (Est'd 1996) & AVN HOF Member - I Crop Pics For Thumbs In My Sleep
 
Greenguy's Avatar
 
Join Date: Feb 2003
Location: Blasdell, NY (shithole suburb south of Buffalo)
Posts: 41,706
Send a message via ICQ to Greenguy
Ramster & I to you!
__________________

Promote POV Porn Cash By Building & Submitting Galleries to the Porn Luv Network
Greenguy is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:14 AM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc