From owner-freebsd-questions@FreeBSD.ORG Wed Oct 1 13:59:20 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DD14816A4B3 for ; Wed, 1 Oct 2003 13:59:20 -0700 (PDT) Received: from priv-edtnes40.telusplanet.net (outbound05.telus.net [199.185.220.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id ED8A043FF3 for ; Wed, 1 Oct 2003 13:59:19 -0700 (PDT) (envelope-from viktorlazlo@telus.net) Received: from njamn8or ([207.6.240.165]) by priv-edtnes40.telusplanet.net ESMTP <20031001205919.QIRU27643.priv-edtnes40.telusplanet.net@njamn8or>; Wed, 1 Oct 2003 14:59:19 -0600 Date: Wed, 1 Oct 2003 13:59:16 -0700 (PDT) From: Viktor Lazlo X-X-Sender: viktorlazlo@njamn8or.no-ip.org To: Dan Nelson In-Reply-To: <20031001203209.GA2421@dan.emsphone.com> Message-ID: <20031001134219.P8342@njamn8or.no-ip.org> References: <20031001232109.0ae5bfd4.martin.vana@vslib.cz> <20031001203209.GA2421@dan.emsphone.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Martin Vana cc: freebsd-questions@freebsd.org Subject: Re: newbie question - how to pass textfile as an argument X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 20:59:21 -0000 On Wed, 1 Oct 2003, Dan Nelson wrote: > In the last episode (Oct 01), Martin Vana said: > > I was just wondering if there is a way how to pass a text file with > > list of path/files to programs like cp/mv. > > If the list is small (less than 65000 characters total): > > cp $(cat myfile) /otherdir/ > > If the list is large: > > xargs < myfile -J% cp % /otherdir/ You could also run it through a for loop: for i in $(cat myfile); do mv $i ~/mydir; done Or if the files can be grouped by a pattern: for i in *.mp3; do mv "$i" ~/mymp3s; done Or if the files are scattered all over your hard drive and you haven't created a list yet: find / -type f -name "*.mp3" -exec mv {} ~/mymp3s \; Cheers, Viktor