Copying Files from Directories

New to Debian (Or Linux in general)? Ask your questions here!

Re: Copying Files from Directories

Postby Deb-fan » 2020-03-22 10:03

Ah was interesting and not all that much time dorking/testing. Hopefully proves useful. Would still advise doing whatever test runs and learning on test data. Until you're confident with things. Tools, methods, info on dealing with viri etc are also well covered many places. Take reasonable precautions and it can all still work out well. Everybody knows data-loss can sting. Error on the side of caution though clearly not a time sensitive situation. :)
Deb-fan
 
Posts: 693
Joined: 2012-08-14 12:27

Re: Copying Files from Directories

Postby pylkko » 2020-03-22 10:55

Look, first of all, a computer from 2013 is brand new. I have a few laptops that I use on a daily basis of which only one is newer than that (2015). One of the is from 2003! My father has a working computer from 1992... Actually, the older the computer is, the more likely it can be repaired by simple tools at home. The guy at the shop is always going to try to solve the problem by taking your money... especially if you live in the US.

Second, if there is a virus on a Windows computer, you do not have to be afraid to "execute" it on Debian, because windows programs simply don't run on linux. Actually I have used linux to succesfully clean windows machines of a virus exactly because of this (the virus is deleted on windows, but because it has infected windows, it is not really removed, it only manipulates windows to lie to you, but when you start the same machine on linux you see the files there).

Third, you could have salvaged that entire machine, by simply either reinstalling windows or linux on that laptop.

Fourth, you/brother physically broke a completely fine working computer because you didn't read the manual on how to open it. OK, I get it your brother is not technical, but he can read, right? I have yet to see a manufacturer of computers that does not have online manuals.

Fith, you caused damage to your server because you used programs without even glancing at their manuals.

Sixth, you ran commands on your computer by copy-pasting of the internet without reading their manuals or even trying to understand how they work on the only copy of the data that your brother wants to save. Wish sheer luck you did not destroy the data or your server.

In all of these things there is a reoccurring pattern, a common denominator...you simply do not care enough to actually figure things out. This is very sad for people attempting to help you because, they might spend time to write to you and send you links, that you just are not going to look at...

I don't to feel like an idiot, but I really believe you could avoid a lot of loss if you did a little more...

The alias is changing the find command to look in / (or the root, i.e first directory of the machine, that is the entire server) instead of in . which is what you apparently want. Just remove it and only add things to your bashrc that you want.
User avatar
pylkko
 
Posts: 1659
Joined: 2014-11-06 19:02

Re: Copying Files from Directories

Postby Deb-fan » 2020-03-22 11:09

SEVENTH! My laptop is from late '09! That's not your fault, just sayin! Actually quite fond of the thing, it's not old, it's a classic. :P

Prying apart a defenseless laptop with a screw driver ... WTH'S WRONG WITH YOU PEOPLE!?! :)
Deb-fan
 
Posts: 693
Joined: 2012-08-14 12:27

Re: Copying Files from Directories

Postby Soapm » 2020-03-22 17:08

pylkko wrote:Sixth, you ran commands on your computer by copy-pasting of the internet without reading their manuals or even trying to understand how they work on the only copy of the data that your brother wants to save. Wish sheer luck you did not destroy the data or your server.

In all of these things there is a reoccurring pattern, a common denominator...you simply do not care enough to actually figure things out. This is very sad for people attempting to help you because, they might spend time to write to you and send you links, that you just are not going to look at...


You're making a lot of assumptions, first of all, I didn't say he HAD a virus, I said I'm guessing he had a virus. But like you, I didn't see the machine before he removed the drive so can only take the Best Buy techs word that it was trashed.

Also, where did I say I ran anything on my server that I didn't understand? I posted the link from the site here with hopes someone would help me understand before I ran it, which is what I've done for years since I know I'm a novice at best when it comes to unix/cli computing. So "if I didn't care", I wouldn't have come here for help. If you don't want to look at the command and give advice, ok, but to lecture someone for asking for help??? I thought that's what the forum was for???

Lastly, I haven't lost anything, if nothing else, his drive is still in tact and I can start the process over from scratch at anytime. But so far what I copied over is still in tact just waiting for me to pick out his useful stuff and delete the rest. Who put the burr in your saddle?

...

Thanks Deb-Fan, your command worked like a charm. However, the command I found on the other site does the additional step of removing the path so the files are placed in the root of the destination folder. As it stands, the way it's working, this readme file will be buried down in all these layers of folders in the destination directory which is kind of defeating the reason I'm going through this.

Code: Select all
/video/zwindowsbackup/Rick/Program Files/WindowsApps/Microsoft.WindowsMaps_5.1706.2001.0_x64__8wekyb3d8bbwe/Collections/PDPProvider/CloudGraph/README.txt


Not saying I need to save this readme file, this is just an example of how all the folders are still being created in the destination folder.

I will keep chugging at it.

ps... I just got a new laptop last year but my previous one was bought back in 09 or 10 and it was running fine until the screen died. It had this yellow hue to it so I had to hook an external monitor to it so see stuff. Other than that it was fine, but I will say that SSD drives are a whole lot faster.
User avatar
Soapm
 
Posts: 572
Joined: 2012-05-22 04:23

Re: Copying Files from Directories

Postby Soapm » 2020-03-22 18:01

Got the script working for me, in case anyone is interested, here it is. The one drawback I see is files with the same name will be overwritten. I wished I knew how to make the count up like readme1 readme2 readme3 etc...

Code: Select all
find . -type f '(' -name '*.bmp' ')' -exec sh -c '
    for pathname do
        newname="${pathname%/*}_${pathname##*/}"  # a/b/c/d.bmp --> a/b/c_d.bmp
        newname="/video/zwindowsbackup/To_Rick/${newname##*/}"  # a/b/c_d.bmp --> target/c_d.bmp

        printf "Would copy %s to %s\n" "$pathname" "$newname"
        cp "$pathname" "$newname"
    done' sh {} +


Now to figure out all the file types I want to save...
User avatar
Soapm
 
Posts: 572
Joined: 2012-05-22 04:23

Re: Copying Files from Directories

Postby pylkko » 2020-03-22 18:51

Soapm wrote:
You're making a lot of assumptions, first of all, I didn't say he HAD a virus, I said I'm guessing he had a virus. But like you, I didn't see the machine before he removed the drive so can only take the Best Buy techs word that it was trashed.

Nobody is/was claiming that you said he had a virus, as far as I can see... and you are missing the point about the computer being trashed. This is not about trusting the salesman, this is about the fact that computers, in general, do not "get trashed", ever. Many of the first computers that were ever built still function. But you did post:

Soapm wrote:I honestly believe his old computer had a virus which is why I'm storing the content on my Debian server and being careful not to execute anything

which is why I am saying that you do not need to worry about running a windows executable on linux.

Soapm wrote:Also, where did I say I ran anything on my server that I didn't understand?

I guess when you posted output of commands in a way that proves that you did not understand what they were before you pressed enter... and when your server had a nonstandard find command because you had changed it to a line that "are not sure what it does". It's hard to imagine better evidence than this...

Soapm wrote:So "if I didn't care", I wouldn't have come here for help. If you don't want to look at the command and give advice, ok, but to lecture someone for asking for help??? I thought that's what the forum was for???

Because there is a difference in between asking for help and preferably doing it so according to what people expect and after reading the guidelines (viewtopic.php?f=11&t=47078) and being lazy, expecting people to serve you. In my view, if you care, you should not do this kind of stuff.

Soapm wrote:Lastly, I haven't lost anything, if nothing else, his drive is still in tact and I can start the process over from scratch at anytime.

Luck is so on you side today...
User avatar
pylkko
 
Posts: 1659
Joined: 2014-11-06 19:02

Re: Copying Files from Directories

Postby Soapm » 2020-03-22 22:10

pylkko wrote:Luck is so on you side today...


Wow dude, is this what this forums has become. Someone creates a topic and you commence to lecturing on things non-relevant to the subject. Who do you think you are? What makes you king of the forum? Who said I have to please you when I create a post? Show me that in the forum rules!

How is it luck to know I still have his drive? Because someone does something different from you doesn't make them wrong, just different. And different from you seems to be preferred, since you appear to have your head up your butt. Careful, you might walk into something... :lol:

Where did the welcoming community of help go that has been my periodic place of support and help go? And has helped so many over the years learn to make sense of the world of linux? Has this place dwindled down to you? Because I can't see many wanting to endure your flaming assumptions and superiority attitude.

Not that I have to explain, my server was first built when Sarge was the flavor of the month, and if somewhere along the line I added an alias to my "~/.bashrc" file for whatever reason then forgot it was there, then shame on me I guess. But I was posting my outputs because they were not what I expected. In other words, I knew something was wrong but couldn't figure out what so I decided to ask the community if someone see's something simple I was doing wrong. But I guess asking for help is no longer allowed in the place where people go for help???

Listen, if you don't want to help folks then why are you here? Is this how you spend your day, lecturing people like you have life figured out and you've never needed help? Why not just ignore thread that don't measure up to your standard instead of going off on irrelevant fits of unexplained anger?

Lastly, it was my brothers laptop. He lives in MO and I live in CO. If he says it was trashed then why does that have to be questioned by you. For all we know he might of have keys missing, a cracked screen, hell, it could have been held together with duct tape for all we know, we didn't see or test it to know what the tech concluded was, "trash". Nor do I think the tech has to run it by you before he tells a paying customer his professional opinion...

Sure, there are a few old computers still in service, but there are far more that have been recycled. I should know, my first was a TRS 80 that ran basic and I've built and recycled plenty since then.

But I will send God your way in my prayers tonight, maybe you can tell him how to cure this virus and you can commence to lecture Him on the things you find wrong with His universe.
User avatar
Soapm
 
Posts: 572
Joined: 2012-05-22 04:23

Re: Copying Files from Directories

Postby Deb-fan » 2020-03-22 23:26

Was going to mention putting that hdd in a safe place, way you were going about things didn't want to draw attention to the poor thing, lol. Seems you've turned things around though and making progress which is the goal. Just snagged a couple existing cmds from googling and dorked to test. Being tech ... ridiculously cool(and/or disasterous)things are possible pushing a few buttons, one of the many things that makes it awesome. Not sure how'd I'd go about such a situation, would just have to roll-up sleeves and dig in, with all reasonable precautions. Treat it(his data) like it's your stuff and do the best you can.

Don't want to muddy the water further. You're making progress and getting bearings. Did want to help solve the original challenge, how to weed out only certain file types from a big lump of data and then consolidate it into one place. Is interesting and no doubt better/easier ways but what's posted seems to work fairly well. :)
Deb-fan
 
Posts: 693
Joined: 2012-08-14 12:27

Re: Copying Files from Directories

Postby Soapm » 2020-03-23 00:42

Deb-fan wrote:Was going to mention putting that hdd in a safe place, way you were going about things didn't want to draw attention to the poor thing, lol. Seems you've turned things around though and making progress which is the goal. Just snagged a couple existing cmds from googling and dorked to test. Being tech ... ridiculously cool(and/or disasterous)things are possible pushing a few buttons, one of the many things that makes it awesome. Not sure how'd I'd go about such a situation, would just have to roll-up sleeves and dig in, with all reasonable precautions. Treat it(his data) like it's your stuff and do the best you can.

Don't want to muddy the water further. You're making progress and getting bearings. Did want to help solve the original challenge, how to weed out only certain file types from a big lump of data and then consolidate it into one place. Is interesting and no doubt better/easier ways but what's posted seems to work fairly well. :)



Yes, I got that script working so made three versions to separate his files.

Pictires
Documents
Videos

Something wierd on the pictures, I can't have both of these arguments in at the same time???

Code: Select all
-o -iname '*.[Jj][Pp][Gg]' -o iname '*.[Jj][Pp][Ee][Gg]'


I can have one or the other but not both. So I'm going to run jpeg separately but have them still go to his pictures directory.

Now that I have all his picture, now comes the laborious chore of eliminating icons, backgrounds etc...

Thanks again for all your help, his drive is safely put away but I found out from runing check disc that it has some bad sectors. I'm wondering if that's what the tech saw that made him recommend a new machine. It doesn't seem to matter to unix since I'm just copying things over but that might have a nasty glitch if this was the OS drive.
User avatar
Soapm
 
Posts: 572
Joined: 2012-05-22 04:23

Re: Copying Files from Directories

Postby Deb-fan » 2020-03-23 01:39

Tech probably saw dollar signs. Nothing new about greedy, lazy, lacking of integrity and professionalism types. Gonna be found in all locations, all walks of life. Clearly irrelevant at this point. Mass removal of files sharing attributes like being named README or etc is yet more basic stuff that's been covered and covered another 100k times for good measure online already. So further exploration of the gnu/nix command-line in this is yours to enjoy. No matter what you're making progress. :)
Deb-fan
 
Posts: 693
Joined: 2012-08-14 12:27

Re: Copying Files from Directories

Postby pylkko » 2020-03-23 05:30

But I will send God your way in my prayers tonight, maybe you can tell him how to cure this virus and you can commence to lecture Him on the things you find wrong with His universe.


Thanks, I'd much rather have you read the forum guide lines before you post though.
User avatar
pylkko
 
Posts: 1659
Joined: 2014-11-06 19:02

Previous

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 13 guests

fashionable