Python Script: Organize Massive files with ease!

HT

JF-Expert Member
Jul 29, 2011
1,897
414
Sometimes it happen you have many files you need to organize bt you cannot. I had 700+ files to organize into folders, something like:
1.Unajibu Maombi album.mp3
blah_blah2.pdf
2.Unajibu Maombi album.mp3
blah_blah3.pdf3.
Unajibu Maombi album.mp3
4.Unajibu Maombi album.mp3
blah_blah1.pdf
......................
Here script will nicely organize them for you
Just change length of directory names in script and drop it in massive files.
Post your modified version but observe that simple copyright (free except...)
Enjoy, HT :A S-omg:
 

Attachments

  • filemanip.py.zip
    960 bytes · Views: 78
also if you have idea on improving, let me know!
 
ah mejaribu kawaida tu, kaka kwan we hujui kuzip file, through zip au rar waweza eka mafile mengi tu, tena kuna super compressor. Mfano game la gta san andreas lina 4.7 gb then linakua compressed hadi 600 mb. Au nipo op umemaanisha chengine?
 
ah mejaribu kawaida tu, kaka kwan we hujui kuzip file, through zip au rar waweza eka mafile mengi tu, tena kuna super compressor. Mfano game la gta san andreas lina 4.7 gb then linakua compressed hadi 600 mb. Au nipo op umemaanisha chengine?
ni kuorganize related files into folders not backup/compress. That is another thing alltogether
 
Kaka congrats kwa ubunifu wako.. mi pia nnajifinza pytho bado cjaimasta fresh naomba niulize kidogo hv inawezekana kutengeneza software complicate kidogo kama maybe kama media player yenye cutevisual interface kama button nzurinzuri na vnginevyo.. mtoa mada naomba unipe mwongozo katika hili...
 
Sometimes it happen you have many files you need to organize bt you cannot. I had 700+ files to organize into folders, something like:
1.Unajibu Maombi album.mp3
blah_blah2.pdf
2.Unajibu Maombi album.mp3
blah_blah3.pdf3.
Unajibu Maombi album.mp3
4.Unajibu Maombi album.mp3
blah_blah1.pdf
......................
Here script will nicely organize them for you
Just change length of directory names in script and drop it in massive files.
Post your modified version but observe that simple copyright (free except...)
Enjoy, HT :A S-omg:
A great solution for simple moves.
Since you have said
Post your modified version
I had a question.
Since your script does not check for similar copies nor file ownership rights, then one might hit a bump when running this code.
How about using existing tools such as RSYNC.
It is optimized for the job of moving resources huge and small also will take care of so many unknowns.
I will post a solution shortly about rsync.

Couple of things the python script did not take notice of are: duplicate files & rights, something else? forgot

the code was well-organized.

Regards,
 
Kaka congrats kwa ubunifu wako.. mi pia nnajifinza pytho bado cjaimasta fresh naomba niulize kidogo hv inawezekana kutengeneza software complicate kidogo kama maybe kama media player yenye cutevisual interface kama button nzurinzuri na vnginevyo.. mtoa mada naomba unipe mwongozo katika hili...
Blender, You tube ni mfano wa Python at work
 
Blender imetengenezwa kwa c++. Ila kwenye application zake mfano game developing ndo wanatumia python.
Blender unapo istart huwa ina start python Interpreter, Pia kuna Scientific packages kama Anaconda, cannopy ni Python at work
 
Blender unapo istart huwa ina start python Interpreter, Pia kuna Scientific packages kama Anaconda, cannopy ni Python at work
Dev:Doc/FAQ - BlenderWiki
ila Blender uses the Python programming language for its scripting API

upload_2016-3-10_16-32-5.png
 
A great solution for simple moves.
Since you have said I had a question.
Since your script does not check for similar copies nor file ownership rights, then one might hit a bump when running this code.
How about using existing tools such as RSYNC.
It is optimized for the job of moving resources huge and small also will take care of so many unknowns.
I will post a solution shortly about rsync.

Couple of things the python script did not take notice of are: duplicate files & rights, something else? forgot

the code was well-organized.

Regards,

Hello,
samahani kwa kuchelewa sana kujibu.
People hijacked this discussion already. Doh!!

I have a lot of respect for the authors skills in crafting an elegant script Though, originally the author wrote the moving script using Python, i thought of just using existing tools and hence avoid re-inventing the wheel.

Anyway my 2 cents contribution regarding moving files from one folder to another.
If one needs a really specific task for rsnyc, i could craft it. Rsync is a big and is optimized for so many things, including slow networks.

rsync - a fast, versatile, remote (and local) file-copying tool

important point is try to use opetions 'n' and 'v' for beginners cause it helps to visualize. after confirming the code, remove the -n flag to proceed

Code:
rsync -nrv --delete-after /source /destination

-n : --dry-run flag
simply pretends the move happens but does not make any changes to the system.

in case there is a limit to files need to be moved then command:
--min-size=1.5m
--max-size=1.2m

Code:
rsync -nrv --min-size=1.2m --max-size=1.5m --delete-after /source /destination

--p flag to preserve permissions
Code:
rsync -nrv --p --delete-after /source /destination

--append-verify flag
this will perform a check some verification on the receiving side.
Code:
rsync -nrv --append-verify --delete-after /source /destination

--ignore-exisiting
flag ignores any files in the receiving
Code:
rsync -nrv --append-verify --delete-after /source /destination

--exclude=PATTERN such as: txt;doc;java
--include=PATTERN such as: text;doc;java
Code:
rsync -nrv --exclude=txt;odt --delete-after /source /destination

Code below will only move text and OpenOffice document text files
Code:
rsync -nrv --include=txt;odt --delete-after /source /destination
 
0 Reactions
Reply
Back
Top Bottom