[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Can you rename files randomly?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 19
Thread images: 5

File: Sin título-1.jpg (262KB, 1280x720px) Image search: [Google]
Sin título-1.jpg
262KB, 1280x720px
Hello, some charitable soul can help me with this.
I would like to randomize the names of some files. But between them. Example:

Normal
A.png - B.png - C.png

Random
B.png - A.png - C.png

The images have not been modified. Just the name of them. It will be in my heart to help me with this. Thank you.
>>
Yes, Node.js can do this easily in under 25 lines.
>>
I have no experience programming.

Only "very little" java (if, switch, else, void)
>>
Yes, you can do this easily in any programming language.

>get list of all file names in folder
>randomize the order of that list
>go through the original list of files, and rename it from the randomized list
>e.g. If you're on file 5, you select the 5th item from the randomized list

Try to do one of those things at a time. You can use Ruby, Python (easy), or the operating system command line scripting (batch in Windows, bash in Linux).
>>
>not fully tested. use at your own risk
#!/bin/bash
ls > /tmp/originalnames.txt
ls | while read line; do echo `echo $line | md5sum | cut -d' ' -f1`\|$line; done | sort | cut -d'|' -f2 > /tmp/targetnames.txt
mkdir renamed
paste /tmp/originalnames.txt /tmp/targetnames.txt | while read line; do src="`echo "$line" | cut -f1`"; dst="`echo "$line" | cut -f2`"; mv "$src" renamed/"$dst"; done
>>
>>61132639
I do not know where to put all that.
I just started all this programming. That's why my name "Newbie"
>>
>>61132728
It's a bash script. It should work on linux and mac. If you're on windows, use Bash for Windows.

Open a terminal, change directory (cd) to the directory containing the files you want to rename, and run the commands line by line.
>>
>>61132728
Your first step is to install Gentoo
>>
>>61132771
That's still to advanced for him
Though CBA to explain it myself
OP, just study programming some more, in a month you'll easily be able to write it yourself
>>
>>61132771
I do not understand the program. I'm still new to this. Same thanks for the help. I hope someone else will help me. Is there any subreddit where I can ask for help?
>>
A few lines in bash should be enough
>>
#!/bin/bash

name=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 12 | head -n 1)
ext=$(echo "$1" | cut -d'.' -f 2)

mv "$1" "$name.$ext"
echo "Renamed to: $name.$ext"


you mean like this?
>>
File: img1.png (21KB, 305x267px) Image search: [Google]
img1.png
21KB, 305x267px
>>61135687
nevermind i didnt read the entire op
>>
>>61132477
>easily in under 25GB of code.
fixed that for you
>>
File: 5954da9d0e8cc110648584.gif (104KB, 765x590px) Image search: [Google]
5954da9d0e8cc110648584.gif
104KB, 765x590px
>>61132462
A bit like this I guess. There's probably easier ways
>>
File: 1447500900388.png (18KB, 300x133px) Image search: [Google]
1447500900388.png
18KB, 300x133px
>>61132462
Made something like this a few years ago when I was a Winfag for game modding. Here it is, Windows only.

https://lewd.pics/chan/b/27.html
>>
>>61132477
With a small 300-sized dependency tree.
>>
File: 1488420514820.jpg (116KB, 1200x948px) Image search: [Google]
1488420514820.jpg
116KB, 1200x948px
>>61132462
os.mkdir('output')
files = glob.glob('*.png')
shuffled = random.sample(files, len(files))

for i in range(len(files)):
os.rename(files[i], 'output' + shuffled[i])

for f in files:
os.rename('output' + f, f)


I haven't tested it cuz >phoneposter
>>
>>61136387
What programs is it?
Thread posts: 19
Thread images: 5


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.