Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Looking for an automated way to move files

Featured Replies

I am looking for an automated way to move the contents of a subdirectory to the parent directory and then delete the resulting empty subfolder.  For example:

 

My movie files are currently stored: Twister\VIDEO_TS\files.  I would like to change them all to Twister\files

 

I dread the thought of manually cutting and pasting for each movie (I have ~570).  Just wondering if there is some quick and easy script or something that would accomplish this unattended.

RockDawg,

 

I'm no Linux expert, but here's an idea (I haven't tried it, so highly suggest you experiment with a dummy file & directories):

 

1.  Telnet into your unRAID server.

2.  Use the "&" command to a command in the background (i.e., the system should immediately return control to you, allowing you to do other things) in combo with...

3.  Use the "mv" command to move your files within the unRAID server (see below)

 

&mv /mnt/disk1/Twister/VIDEO_TS/files /mnt/disk2/Twister/files (you may need to create the Twister\files directory first).

 

 

I haven't looked, but is PERL enabled via Unraid?  I would have to crack open a book to remember how to do what the OP wants, but that would be a lot faster than doing 570 individual mv commands.

 

 

Bill

I would use a batch file or script, something like this pseudocode:

 

for  %dir  in  ( * )

    if  exist  %dir\VIDEO_TS\*.*

        echo  %dir

        move  %dir\VIDEO_TS\*.*  %dir

        del  %dir\VIDEO_TS

 

It will take a lot longer to work out the syntactical details, and test it, than it will take to run this script/batch, perhaps less then 10 minutes to run. I would test it on a temp folder containing copies of 3 movie folders.

 

Since you are only moving directory entries, not moving or copying files, I think it would be better to do everything on a Windows machine, because you will have more choices available in scripting or batching tools.  I'm afraid my batch file skills are too rusty to help.

 

  • Author

RobJ - not exactly sure how to run that.

I was hoping that one of the expert scripters here would provide a script or batch file for you, or that you had a favorite batch or scripting tool.  I've created many batch files, some quite complex, but that was in my DOS days, prior to Long File Names.  Batch files have changed some since then, and I'm very rusty.  If I get to it, I'll try to come up with something, doesn't look very hard.  I'm lazily still hoping someone else will though!

 

  • Author

I see.  Don't bother yourself with it then.  I've never done any scripting or created a batch file and I don't want people to have to research it for me.  I just thought it might be easy enought that someone would know off hand how to do it.  Thanks anyway.

  • 4 weeks later...

Sorry, don't mean to hijack a thread here, but how about moving files from your inbound box (the computer that you use to get your source files) to your Unraid server?

 

I use Azereus and I can move files from one directory to another after the download is complete, but I'm trying to think of a way to have them moved over to the server after the upload ratio has returned to 1.

 

Any ideas?  Or should I wait for the version of unraid that includes file management under the covers?

 

Thanks.

 

  • 13 years later...

I'd really appreciate if a script was made to do exactly this and if you didn't know the name of the subfolder, in OP's example "VIDEO_TS" is not known say, because you will not know what you will download in the future.

 

Edit: I have found a script that works:

 

#!/bin/bash
find /mnt/user/hms/Materials/Books/Mainfiles -type f -exec mv --backup=numbered -t /mnt/user/hms/Materials/Books/Mainfiles {} +

 

Edited by Arby

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.