DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 7th October 2008
MustLearn MustLearn is offline
New User
 
Join Date: Oct 2008
Posts: 2
Thanked 0 Times in 0 Posts
Unhappy Help With [seemingly] Simple Problem

Alright, this is one of those moments when a normal person is forced to become terminal typing freak (sorry guys =)) against their will...

I have a FreeBSD7 server box in my garage that serves the computers on my network with files. It has been a godsend: 2 1TB SATA drives raid-1'd and I have a peace of mind that all my files are secure in one place in the house that has doubled as my office.

The box has basic non-gui install of FreeBSD7 and I access it through WinSCP from other boxes around the house. Voila! So easy!

Well it was until I decided to bring some order to it - sort files in the right directories. This is usually a snap in XP, but UNIX would not allow things to be simple I guess: When I want to empty out few folders into another folder ("DUMP") and there are same files in both folders (one I am copying from (Downloads) and one I am moving them to(DUMP)) I get an error:

HTML Code:
General failure (server should provide error description).
Error code: 4
Error message from server: Failure
Request code: 18
My guess was that it found similar named files and flipped out only leaving me the options to skip or abort (I skipped). So I decided to do it through command line via Putty. Friend of mine suggested this command through bash:
HTML Code:
 mv Downloads/* .
Effect was the same: I get a polite error notifying me that: :
HTML Code:
FileName.extension: Directory not empty
Whoopty do!

XP would be nice enough to give me options: name of conflicting file; sizes; options: Abort, Overwrite, Skip

These options are crucial because some files may have changed and I may want to rename the file and save it as a newer version while keeping the old one. I usually find this out by looking at the file sizes.

Is there a way to do the same from command line?

I asked my friend and he just said I will have to manually look all the information up (to compare) and delete or rename. This would be madness when I have to deal with hundreds or thousands of files...I would be sitting in front of the monitor for weeks just busy with one task. He also said "I''m sure you can write a script" I guess that's the best way to tell the noob to bug off.



Please tell me if there is an easier way to approach my task.
Reply With Quote
  #2   (View Single Post)  
Old 7th October 2008
jb_daefo jb_daefo is offline
Package Pilot
 
Join Date: May 2008
Posts: 196
Thanked 5 Times in 5 Posts
Default

how many directories, how many files?
...........
I usually copy (cp -iv) then delete (/bin/rm -iv ) OR use mmv (a port)
..........
or do command(s) such as
find . -type f -name "a*.fil" -exec mmv {} /new_dir \;
............
better, quicker ways but since the situation probably won't repeat, no
since to script it, just do it slower
__________________
using /LOOKAT/ with /var/db/pkg files and portmaster/aliases/pipes/find/grep to meteorically speedup port upgrades/installs...
Reply With Quote
  #3   (View Single Post)  
Old 7th October 2008
MustLearn MustLearn is offline
New User
 
Join Date: Oct 2008
Posts: 2
Thanked 0 Times in 0 Posts
Default

Thanks for that!

few hundred dirs and few thousand files in them.

How to install mmv through ports?


I found this: http://www.freebsdports.info/ports/misc/mmv.html
Reply With Quote
  #4   (View Single Post)  
Old 7th October 2008
jb_daefo jb_daefo is offline
Package Pilot
 
Join Date: May 2008
Posts: 196
Thanked 5 Times in 5 Posts
Default

cd /usr/ports/misc/mmv
make install
rehash
..............
you need the ports tree for the above commands to all succeed, and an
active Internet connection
mmv only works on one file at a time. With thousands of files you would
use the longer command lines for most of them (if you know some have
unique names, mmv might be quicker for just those)
__________________
using /LOOKAT/ with /var/db/pkg files and portmaster/aliases/pipes/find/grep to meteorically speedup port upgrades/installs...
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple human front-end for 'bc(1)', the unlimited precision calculator J65nko Guides 1 2nd February 2013 06:50 PM
A simple question Mr-Biscuit Off-Topic 1 16th April 2009 04:26 PM
Simple Firewall with PF jones FreeBSD General 3 7th November 2008 02:02 AM
Simple/easy ircd Weaseal FreeBSD Ports and Packages 0 17th July 2008 12:31 PM
Quick, simple tcsh tips for beginners anomie Guides 6 5th May 2008 08:07 PM


All times are GMT. The time now is 12:22 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick