Bing search AI just wrote code to sort my mp4/funscript sets into named directories

The ai explanation is better than i can do so…

for f in *.* ; do
  bn=$(basename -- "$f")
  mkdir -p "$filename"
  [ -e "$filename/$filename.$ext" ] && mv -- "$f" "$filename/"
  case $ext in
    funscript) mv -- "$filename/$filename.$ext" "$filename/$filename.funscript" ;;
    mp4) mv -- "$filename/$filename.$ext" "$filename/$filename.mp4" ;;

This script creates a directory with the same name as the file (without the extension) and moves the file into that directory. The basename command extracts the filename without the extension, and the mkdir command creates a directory with that name. The [ -e "$filename/$filename.$ext" ] condition checks if a file with the same name already exists in the directory. If it does, the file is moved to the directory. The case statement checks the extension of the file and renames it to .funscript or .mp4 accordingly.

Please note that this script assumes that the files are located in the same directory. If you want to run this script in a diffTexterent directory, you will need to modify the path accordingly.

I hope this helps!

i tried to do some fancy editing but block quote was all i could manage. sorry. Anyway i went through several phases it was uncanny, hold on lemme see if i can copy and paste…

and bam boom

  • Time at the start of this conversation is Thu, 18 Jan 2024 tmi
    -The user is located in nope
  • User’s language might be different from the language commonly spoken in their location.

so i guess im missimg part or something with the copy and paste mechanic is afoul. eitheir way tbc…

i just came back to edit this . im so high. i dont even know if this works. i dont even know how to make it work at all. i was just going to paste in powershell and see what happens . tbc…

so second edit… that definately did something. unfortunately thhat something was the to the directory the powershell was defaulted to. How would someone reverse that? is there like a ctrl^z situation i cant find the fucking question mark button on this tiny handheld keyboard.

1 Like

oh and in case it wasnt clear , i reread that post above that took me an hour and a half to write because marijuana, and thought i wasnt clear on something but now i forget what this shit is about altogether. oh yeah the ai wrote the script i told it that certain aspects were incorrect, name of directory being after extensions instead of filenames for example. i would say correct thing and ai would fix. those conversations are what im attempting to provide the forum. if i can figure it out snd if anyone is intrested.

1 Like

so it didnt work but it could. this was a ‘how to’ community source some powershell shit to do this for us !!! yea man !!! i dont know what im doing guys

1 Like

Yeah, this is just you wobbling around talking to an AI.
IIEleven11 made a bat script to find non-matching videos and scripts.
If you want to make a script that moves all matching mp4 and funscript files to a subfolder with the matching name, learn to understand Eleven’s script. Everything you need to make this script is used in that bat file.

1 Like

Well yeah… because marijuana. :rofl:

If he was on cocaine we’d probably get a post the length of ‘War and Peace’.

this is a shell script, it does have a few safety features but you should be careful. I hesitate to tell you how to run it because there are a couple things its not doing which could result in loss of data because you overwrite it. I’m not really willing to test it though. It could work. If you wish to use it. you would paste it into a text file then save it as a .ps1 extension so for example


make sure to change it from a text document to “all files” when you save. Then you double click the created .ps1 file and it will run.

Again, I really do not suggest you do this without knowing what you’re doing and most definitely you should edit the original post to warn people accordingly. You CANNOT retrieve a file if it has been written over by another file. There is no recovery tool capable of doing this. It will be gone forever.

If anything you can edit my script as seen above by giving it to AI. I suggest not using an AI thats incompetent when it comes to coding. GPT4 would be your best option there.

Tried editing the bat script to do this myself. It worked, but I gotta say it sucks in terms of organizing files.
I like to keep separate folders for artists I have multiple videos from, but most videos and scripts all together in a single folder. This way I can sort by date, size etc.
Having a folder for every video-script pair might work for some people, but it’s not for me.