How to make a copy and delete command line.

Arch based Porteus community project

Moderator: M. Eerie

Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

How to make a copy and delete command line.

Post#1 by Jack » 28 Dec 2016, 23:03

How would I do this?

Copy this ALPM_DB_VERSION. from /mnt/sdb1/var/lib/pacman/local/ALPM_DB_VERSION to /mnt/sdb2/build/001-core/var/lib/pacman/local.

And this?

Delete this when done ALPM_DB_VERSION from /mnt/sdb2/build/001-core/var/lib/pacman/local/ALPM_DB_VERSION.

And this?

Delete this when done /var/cache/pacman/pkg/*.pkg.tar.xz

I have never done this before I have use MC to do all of my copy delete and move.

I'm trying to building a script but not sure how to do it. So what would the command line look like?
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: How to make a copy and delete command line.

Post#2 by Ed_P » 29 Dec 2016, 00:25

copyanddelete.sh

Code: Select all

#!/bin/sh

cp  /mnt/sdb1/var/lib/pacman/local/ALPM_DB_VERSION   /mnt/sdb2/build/001-core/var/lib/pacman/local/

echo
echo Press Enter when ready to delete the files.
read

rm  /mnt/sdb2/build/001-core/var/lib/pacman/local/ALPM_DB_VERSION 
rm  /var/cache/pacman/pkg/*.pkg.tar.xz
Something like this what you're looking for Jack?

Save it in your /home/guest folder then in terminal mode make it executable with:
chmod +x copyanddelete.sh
then you can run it with ./copyanddelete.sh

Needless to say you can change the copyanddelete name to whatever is more meaningful to you.
Ed

Jack
Contributor
Contributor
Posts: 1857
Joined: 09 Aug 2013, 14:25
Distribution: Porteus and Nemesis
Location: USA

Re: How to make a copy and delete command line.

Post#3 by Jack » 29 Dec 2016, 01:22

Thanks ED_P that what I was looking for. When I get done I will post what I'm doing with it.
I just like Slackware because I think it teach you about Linux to build packages where Ubuntu is like Windows you just install programs you want.

Post Reply