Apple Script is undeleting files (Lion) and the OS keeps asking for a password. Is there a way around this. - osx-lion

So a funny thing happened to me last night. I was trying to clean files off my Macbook Pro.
I just purchased a new Macbook Retina and it has a smaller hard drive than my old Macbook Pro (I know cry me a river).
Anyway I was in Finder and I found a whole bunch of files and I selected them all and hit the good old delete key.
And gosh darn if my Mac didn’t immediately got to working whacking my files. What I didn’t realize that I had a view of my entire network of files including my Dropbox documents, family pictures and even some naughty images from my college years (don’t tell my wonderful wife).
The total number of deleted files was over 4,000. I almost cried.
No big deal I just go to the Trash and undelete right? Not so fast Tonto!
I want to have the files moved back to their original location. While the Lion supports this feature, it will only allow you do restore one file at a time.
With 4,000+ files my eyeballs would fall out by the time I finished.
Fortunately someone at Apple invented Apple Script.
And someone else wrote a script that will undelete files one file at a time.
I ran the script went to bed and found that it worked!!!!
Of the 4,000 file only 1,700 remained in my trash (Woo Hoo!!!).
The problem is the remaining files require me to enter a password before the restore can take place. I believe these files were created under a different owner.
My question is how can I get around this?
Is there a way to enter a super duper user mode that eliminates me having to enter a password for every file I want to undelete?
Any help is greatly appreciated.
Here is the Apple Scrpt:
repeat 4173 times --or as many files you have
tell application "Finder" to open trash --open the trash folder
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
delay 0.2 -- adjust delay as needed
key code 125 --move down to get focus on a file
key down command --hold command key
delay 0.2 -- adjust delay as needed
key code 51 --hit delete
key up command --release command
end tell
end tell
delay 0.2 -- adjust delay as needed
tell application "Finder" to close every window --close everything for the next cycle
end repeat

Fine you don't want to answer my question! I'll answer it myself (>:P).
Anyway my issue was caused by file permissions. Some files were locked down in such a way that I needed to enter a password to undelete them.
I was able to fix this using the chmod command.
Cheers!!!!

Related

Unity erased all my progress on my project back to original state

I started a new project and after closing and reopening it the next day, all progress was gone. It didn't crash and there weren't any abnormalities. I didn't touch any files in file explorer so it's not like I could've reverted the project or something. And yes I saved, I always save. Recycling bin is empty so it wasn't deleted. So I haven't much idea what the cause could've been, or what else to put really.
But is there any explanation for what could have caused this so next time in the future I can prepare for all my progress being erased out of the blue. And is there any way I can retrieve the files back somehow too?
Using version 2020.3.2f1
Have you tried looking through temp files? Because I had this problem too a while ago and was able to retrieve the data which was hidden in the files somewhere. I had a backup and it didn't help because it didn't save to the backup obviously. I don't know why Unity still has this problem and there's not a lot of help on the internet regarding it either

Can’t submit file for Facebook App Approval

I’ll set my outrage with the way this process works (to whom can I speak?) aside for the moment: we are attempting to provide FB with a link to our ~200 mb app for approval. We have been rejected 3 times because they are incapable of extracting our zip file (they request a zip for some unknown reason — it has minimal size impact).
Some detail: we are linking to the zip on our Dropbox. We have removed all punctuation from our app title (Pandamonium!.app becomes Pandamonium.app). We have eliminated spaces from our source folder. I thought all these could be causing a problem with iOS-sim.
I’m not sure what is left to do, but I am hoping someone can present a clear set of instructions (NOT THEIR INSTRUCTIONS, WHICH I HAVE READ) they have followed particularly if you have met similar snags or ANY ideas for resolution. All they send me is useless screenshots of their simulator unable to open the app which I have simulated and opened successfully daily with iOS-sim for the last week.
After a great deal of trial and error I found that using Facebook's command-line instructions was what was causing the issue. You should just compress your .app file in an ordinary fashion (right click and compress -- I used a Windows computer just to make sure everything was copasetic after reading about bizarre Mac .cbgz compression issues).
Regardless, in summary, I can now see why no one else has had an issue with this: it's because no one reads their instructions and rather just creates their .zip files in the ordinary way; unsurprisingly, you're better off using your common sense rather than listening to others.
Aside: ironically, after being told my use case was fine and the only issue was not being able to unzip, Facebook (India) has now told me they couldn't find my login button (which is gigantic, in multiple places, and clearly described in my instructions). This process is an absolute joke. I wish anyone going through this hell good luck.

missing source files

This is NOT a life or death issue. I do have a backup from 2 or 3 days ago. - I think the answer to this may be "Learn to always save & backup your files every night, before you turn out the lights and go home" but just in case there is a happier answer, here goes.
I was programing some Android/Java stuff in Eclipse. I left the machine on with eclipse open and a couple of source java/xml files open inside of eclipse and gave up for the night. When I sat down at the machine this morning, I had a message that windows had preformed an update, and had re-booted my machine. after re-logging in and opening Eclipse it showed the source files in edit windows and they looked normal, but as soon as I tried to type in the edit window, I got some kind of a message that "Files are derived, do I really want to edit them" (I could be wrong on the exact wording. I didn't copy the text down before hitting no or Cancel or whatever the choice was that I thought would get me out of there without doing anything). after I left that screen, it showed me a now blank edit window for the source files. I closed that and and tried to re-open the file from the Package Explorer, but it wouldn't open. So I closed Eclipse and took a look in the /src directory and it appears the source files are gone. I do have a backup from a couple of days ago, so it's not a life or death problem to go back, but my real questions are.
1- Is this a normal occurrence when a machine boots/power fails/crashes unexpectedly with source files open in Eclipse?
2 - Did I answer the "Files are derived..." question wrong? is there something I could have done at that point to rescue the file?
Any comments welcome. - Joe
If you remember where your files were, you could right click on the parent in the Project Explorer > Restore from History or Replace With > Local History.
This feels like a very basic local VCS.
Even though this is not an endless history, you can extend the size allowed for Eclipse to keep such previous versions.

Making and Interfacing with Custom Services

I've been searching for this for awhile now, and I am not sure if I am just not using the correct search terms or if the answer is really that hard to find.
What I am trying to do is to create a new Windows service for a game server from a batch file, and then have a task run another batch file every 30 minutes or more that would run two commands on the game server's command line and do some file work.
Specifically, I am running a Minecraft server using Bukkit for a gaming community I help run, and I want to make sure that the thing is always up unless I specifically tell it to stop (like a service). Bukkit is run directly from a batch file and has it's own command line thing running on it.
I am told that you CAN run this type of thing as a service, but the command line will be hidden from view and/or interaction. This is the second part of my query. I have a handy little backup.bat file that copies all the world files and userdata files into a backup directory, 7zips it, and deletes the directory. The only thing is, is that Minecraft likes to always have the worlds' region files open and writing at all times, meaning that it could cause map corruption if I just run it straight off. To compensate, I need to run the command "save-off" on the server to disable the file hooks temporarily, run the backup, and as soon as it finishes, run "save-on" so that the game can continue without lost data.
What I would like to know about this second one is, is it possible to interface with the game service through a batch file, or do I need to create an application to do that? If the latter, how exactly does one go about doing that? I have moderate C++ knowledge (up through my second OO-C++ course in college), and can possibly learn another language if absolutely necessary.
So, in short, two questions:
1. Is it possible to, and how to run a BAT file as a Windows Service?
2. How to interface with said service via BAT files, and if not possible, what kind of application do I need to write (redirection to or writing a tutorial works for me).
Thank you in advance for any and all help!
Old question, user account doesn't seem active on SO anymore, but hey, if you stumble upon this because you have a similar problem:
Since we are speaking about a Bukkit Minecraft server, turn to the "Essentials" plugin for Bukkit.
It now includes a Backup function that does exactly what the OP asks for, namely stop the save so the files can be manipulated without corruption, launch a script, then starts again.
The script can be a backup one (examples provided in the linked page) but can be used to run any operation on the world's files.

Help! Recover Eclipse file [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 13 years ago.
Improve this question
I'm using eclipse, when i close eclipse, it ask me save a file, I press yes and eclipse shuts down. When I open my computer I see that the drive only has 3 bytes left, and I get a bad feeling. I go to my file and oh my god, it's totally blank, size is 0 byte! :(
I need that file back, can a free recovery program can work on this case?
Sometimes Eclipse keeps the changes it made to the files you edit. Does not always work but it's worth a try :
Find you file in your (package, project, navigator) explorer.
Right click on your file and look for the menus to compare... (I recommend Compare though in your case it will not matter since the file is now empty)
Choose Local History... from the sub menu
If you are lucky and had been using Eclipse to edit the file you should find a few entries there. Look them up, chances are you will find the content.
This has helped me countless times and saved my ass on many occasions. However, every times I resort to it I always feel like hitting my head with a baseball bat for not commiting changes to the source control system earlier.
good luck, if that does not work I fear the SO will not be of much help to you :-(
--- EDIT ---
Little something that can help make this trick a tad bit more useful.
you can change the amount of information Eclipse keeps in local history, go to your preferences and then general->Workspace->Local History (Indigo here, may be different on other versions). If you tend to be light headed or burn the midnight oil a bit too much this will help you repair the next day that bug fix you insisted on finishing before going to sleep.
If you know some phrase or uncommon word from your file, you can search the raw sectors of the hard drive for pieces of text. This will turn up the text anywhere it might have been written: as paged out virtual memory, as a stil-existant file (temp file or saved file), or as temporary or saved file that was deleted and the space has not yet been rewritten.
But it will be slow. And if the file was never written to disk, it will yield nothing. And what it yields may be fragmented or incomplete.
Boot a Knoppix CD and start grepping! Knoppix is a linux installation that runs from CD, without writing to your hard drive.
get knoppix: http://www.kernel.org/pub/dist/knoppix/KNOPPIX_V6.0.1CD-2009-02-08-EN.iso)
Boot it. Start a terminal. Search the hard drive:
$ sudo grep "Four score and seven years" /dev/hda
If it turns up anything, copy and paste to a text editor, and save to usb stick or send it to yourself via web-based email.
If you have SCSI or SATA disks, you need to use /dev/sda instead of /dev/hda
The other answer is correct, every moment that OS continues running decreases your recovery chances. pull the power and use another computer to prepare the knoppix CD.
First, turn off the computer. Every second that it is on and being used at this point reduces the chance you'll recover your file.