LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-10-2018, 05:29 AM   #16
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,127

Rep: Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923Reputation: 2923

Quote:
If it's repeatable action, maybe write a script
Make an effort yourself, you might learn a useful skill.
 
Old 03-10-2018, 05:55 AM   #17
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: FreeBSD/Slackware-14.2+/ArcoLinux
Posts: 9,130

Rep: Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925Reputation: 1925
Quote:
Originally Posted by bmxakias View Post
Not practical at all

Yes i am talking to move it at the same partition....
then use the other scenario, and give it a try already.
 
Old 03-10-2018, 07:46 AM   #18
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Quote:
Originally Posted by syg00 View Post
Make an effort yourself, you might learn a useful skill.
Code:
cd /home/folder/folder2/folder3/folder4
shopt -s extglob
rm -rf !(uploads)
 
Old 03-10-2018, 08:42 AM   #19
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004Reputation: 1004
Post Moving across partitions

Quote:
Originally Posted by scasey View Post
Moving a folder should be a blink, no matter what the size, because (if I understand correctly) mv doesn't actually relocate the folder, just changes the pointer to it in the metadata.
That's correct if the move is on the same file system. If it crosses a partition boundary, it actually moves the files,
 
Old 03-10-2018, 08:49 AM   #20
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 5,272

Rep: Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918Reputation: 1918
Perhaps 'chattr -R +i /home/folder/folder2/folder3/folder4/uploads/' would work for you.
 
Old 03-10-2018, 10:56 AM   #21
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 4,298

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Quote:
Originally Posted by bmxakias View Post
If my uploads folder is 400GB and my disk size is 500GB it will work to move it on another directory or it will need to allocate first the full size and then to free it as that will not work?
Moving the uploads directory to another directory on the same filesystem takes ZERO additional space and just a few milliseconds of time. When you run "mv /home/me/stuff/uploads /home/me", all that happens is:
  1. A link to "uploads" is created in the /home/me/ directory,
  2. The existing /home/me/stuff/uploads link is deleted, and
  3. The ".." link in the uploads directory is adjusted to point back to its new parent.
That's it. That whole sequence is atomic -- nothing can get in the way. No files get copied. Nothing else changes.

(OK, I lied. It's not exactly zero added space. There's a possibility that another 4 kilobyte block might have to be added to the /home/me directory to accommodate the new entry. If you were that tight on space you would be having trouble logging in.)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Exclude a folder on tar ASTRAPI Linux - Newbie 6 11-17-2014 10:54 AM
[SOLVED] exclude nested folder from tar threezerous Linux - Newbie 4 11-01-2014 02:20 PM
Find dont exclude folder postcd Linux - General 7 08-23-2014 09:24 PM
TAR Exclude everything in folder except this folder rationalthinker1 Linux - Newbie 5 04-30-2012 08:20 PM
Exclude a folder from a recursive delete? raz230 Linux - General 6 12-23-2011 01:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration