Detect and renaming the files
Posted: 14 Apr 2018 13:23
Every week I downloaded mp4 files more than 200 episodes/series and many other types. such as .exe and .pdf .The original folder is the download folder,Now it have more than 100000 files including sub-folders(Because it is really tiring to rename and move the file one by one). Some of them i downloaded the same file multiple times because the old ones BURIED in lot of files and did not find them.
If this program is successful it would save my time for 1 year rather than doing it manually
I try to rename the files in a more precise name like :
(I did not put name clearly in the past,Because the average age here is old and not interested in it and now i have put it in order to make clearer)
Anime :
366 DC DOWNLOADNIME.mp4 to Detective Conan Episode 366.mp4
( Detect 'DC' and '367' )
JP-OP831ID-360p.mp4 to One piece Episode 831
( Detect 'OP' and '831' )
One-Piece-Episode-833.mp4 to One piece Episode 833
( Detect 'One-Piece' and '833' )
Notes:1. As you can see,Every original files has a different names patten ( Sometimes names behind numbers or vice versa )
2. ( JP-OP831ID-360p.mp4) and ( One-Piece-Episode-833) are the same anime.
3. ( 366 DC DOWNLOADNIME.mp4) I do not want " DOWNLOADNIME" because it's just information from the website.
Installer :
vlc-3.0.1-win32.exe to Vlc.exe
( Detect 'vlc' )
Firefox Installer.exe to Firefox.exe
( Detect 'Firefox' )
ChromeSetup.exe to Google Crome.exe
( Detect 'Chrome' )
Also i have over 100 other file types at same directory that i want to rename and move it by same method
I tried to look at their code but I did not understand it completely,
viewtopic.php?f=3&t=8465&p=56116&hilit= ... ile#p56116
viewtopic.php?f=3&t=8457&p=56081&hilit= ... ile#p56081
viewtopic.php?f=3&t=8457&p=56079&hilit= ... ile#p56079
Maybe The way it operates is:
1
etects file types ,
2
etects name and numbers(episode)
3
etects file categories ,
4 :rename the files
5 :move the files (For now it not important)
Most Commands/ways i did not know because i never used it
So far i have just:
Files Manager.bat
Notes 1. As you can see MD and REN comands will not work as expected as i am using 'spacing' to split the folder name and names.(i hope there is another way)
2. it just do process one file each loop (i know how to do it)
3.I do not know how to detects file names/types (real problem)
Output what i need from code above
1. Rename the file according to given setting
(For now i just want renaming it first ,about moving the files maybe i tried modify it myself later)
2. Move the file according to given setting
Anime files will move to the anime folder and move again by the anime name.
: Download/anime/One Piece/One piece Episode 833.mp4
ownload/anime/Detective Conan/Detective Conan Episode 366.mp4
Installer files will move to the Installer folder and move again by the Installer category.
: Download/Installer/Media/Firefox.exe
ownload/ Installer/Network Browser/Firefox.exe
Maybe i do not need full code, Which is more important i can learn and understanding every written code,Thanks.
If this program is successful it would save my time for 1 year rather than doing it manually
I try to rename the files in a more precise name like :
(I did not put name clearly in the past,Because the average age here is old and not interested in it and now i have put it in order to make clearer)
Anime :
366 DC DOWNLOADNIME.mp4 to Detective Conan Episode 366.mp4
( Detect 'DC' and '367' )
JP-OP831ID-360p.mp4 to One piece Episode 831
( Detect 'OP' and '831' )
One-Piece-Episode-833.mp4 to One piece Episode 833
( Detect 'One-Piece' and '833' )
Notes:1. As you can see,Every original files has a different names patten ( Sometimes names behind numbers or vice versa )
2. ( JP-OP831ID-360p.mp4) and ( One-Piece-Episode-833) are the same anime.
3. ( 366 DC DOWNLOADNIME.mp4) I do not want " DOWNLOADNIME" because it's just information from the website.
Installer :
vlc-3.0.1-win32.exe to Vlc.exe
( Detect 'vlc' )
Firefox Installer.exe to Firefox.exe
( Detect 'Firefox' )
ChromeSetup.exe to Google Crome.exe
( Detect 'Chrome' )
Also i have over 100 other file types at same directory that i want to rename and move it by same method
I tried to look at their code but I did not understand it completely,
viewtopic.php?f=3&t=8465&p=56116&hilit= ... ile#p56116
viewtopic.php?f=3&t=8457&p=56081&hilit= ... ile#p56081
viewtopic.php?f=3&t=8457&p=56079&hilit= ... ile#p56079
Maybe The way it operates is:
1

2

3

4 :rename the files
5 :move the files (For now it not important)
Most Commands/ways i did not know because i never used it
So far i have just:
Files Manager.bat
Code: Select all
:loop
::Detects_types
If %filetype% equ exe set "types=installer"
If %filetype% equ mp4 set "types=Anime"
goto names
:Name
::Anime
If %filename% equ DC set "filename=Detective Conan"
If %filename% equ OP set "filename=One Piece"
If %filename% equ One-Piece set "filename=One Piece"
::Installer
If %filename% equ vlc set "Vlc"
If %filename% equ Chrome set "filename=Google Crome"
If %filename% equ Firefox set "filename=Firefox"
goto categories
:categories
::Anime
If %filename% equ Detective Conan set "categories=Anime"
If %filename% equ One Piece set "categories=Animes"
md Animes/One Piece
md Animes/Detective Conan
::Installer
If %filename% equ Vlc set "categories=Media"
If %filename% equ Firefox set "categories=Network Browser"
If %filename% equ Google Crome set "categories=Network Browser"
md Installer/Network Browser
if %categories% equ %Anime% ren %originalfile% %filename% Episode %Episode%.mp4
if %types% equ %instaler% ren %originalfile% %filename%.exe
goto loop
2. it just do process one file each loop (i know how to do it)
3.I do not know how to detects file names/types (real problem)
Output what i need from code above
1. Rename the file according to given setting
(For now i just want renaming it first ,about moving the files maybe i tried modify it myself later)
2. Move the file according to given setting
Anime files will move to the anime folder and move again by the anime name.
: Download/anime/One Piece/One piece Episode 833.mp4

Installer files will move to the Installer folder and move again by the Installer category.
: Download/Installer/Media/Firefox.exe

Maybe i do not need full code, Which is more important i can learn and understanding every written code,Thanks.