Deleting a directory without looking inside - macos

I have a directory in my hard drive which causes a bug that opening this directory opens itself again and again in a loop. And this goes on until computer freezes. I have tried with several program and couldn't remove it. Is there a command line command that removes directory without ever looking inside it so, i can get rid of this file.
I am looking for any solution than formatting my hard drive, doesn't have to be command
Thank you

Write a C++ code using this library
https://msdn.microsoft.com/en-US/library/67y3z33c(v=vs.80).aspx
and edit that directory with the code

Related

PATH related issues

A couple of days ago, I added code to my Mac's PATH to make some newly installed programs work properly on my machine. Unfortunately, it seems I have messed it up somewhere because some additional lines are printed every time I open my terminal.
Here is a screenshot of my terminal:
And here is a screenshot of my PATH Variable:
Does anyone know how I can remove extra lines in my terminal?
Thanks in advance
I renamed my ~/.zshrc file to ~/.zshrc2. Then all the extra lines were not shown anymore while opening up my terminal. Now I am sure the problems belong somewhere in my ~/.zshrc file
You can rename a folder by entering this command mv old-name-folder new-name-folder in the folder's directory.

How execute file from parent directory without changing directories

I'm an enthusiast of efficiency. I want to execute a file in a parent directory and would appreciate it if anyone knows of a slick way to do it.
I'm using Windows command line.
lets say i have a file: C:\Documents\text.txt
and my current directory is: C:\Documents\pycode
I would like to open the textfile without changing directories or writing entire filepath.
I tried "..\text.txt" but it doesn't work.
Just add quotes.
"../text.txt"
Or, you can try this:
notepad "../text.txt"

I can delete files in shell when in the directory, but I get a File not found error from outside the directory

I know this is a rudimentary question, but I am dumbfounded.
Let us say that I have two files in the following directory structure:
C:\Program Files\Program\Directory\Subdirectory\one.txt and C:\Program Files\Program\Directory\Subdirectory\Subsubdirectory\two.txt
When I run the following command in shell, I get File not found errors...
del C:\Program Files\Program\Directory\Subdirectory\one.txt C:\Program Files\Program\Directory\Subdirectory\Subsubdirectory\two.txt
I have also tried wrapping the file path and names in quotes with no success.
I have also tried a simple test on two files sitting on a user desktop without success: C:\Users\User\Desktop\one.txt and ...\two.txt etc.
For reference, I want to push a script which will remove the maintenance and update functionality from Firefox to prevent users from getting update messages etc, automatic updates and to break the functionality should someone find out how to try [I am also running mKiosk extension], and I want to push the script using SOTI MobiControl software.
You have spaces in your command path. You need to quote your arguments:
del "C:\Program Files\Program\Directory\Subdirectory\one.txt"
I have not found a solution to this syntax issue - however the problem is solved by the functionality of the SOTI Mobicontroler software.
In the package/script delivery, I am writing individual del commands for each file. SOTI appears to handle each script line one at a time and sequentially.

The command to move file * .pas to file * .exe in fpc.exe

I have a fpc.exe executable file that is supposed to transfer the * .pas file to * .exe file but when i click on it to write command it shows help, i write command but it does not work. The command is as follows (I learned from this link :https://www.freepascal.org/docs-html/user/userse10.html)
  fpc [options] prog.pp
I wrote on the command box
fpc C: \ Hello.pas prog.pp
I put the Hello.pas file in drive C
What should I do in this case
Thank you so much I tried it another way, is to cmd and then type the command
fpc D: \ Hello
And this is my video
https://youtu.be/MsOfohAZjqg
I finally did it. Thank you.
I wrote on the command box
fpc C: \ Hello.pas prog.pp
There are several things wrong with this:
You should leave out the "prog.pp". The example in the link is using that as an example of the name of the source file to compile. Yours is Hello.Pas.
There should be no spaces in the file name of the source file.
Do you have write permission to the root directory of your C: drive? If not, you should move your source file(s) to a directory where you do.
So, you need something like this
fpc C:\mypascal\Hello.Pas
This will only work, btw, if fpc is on your OS Path. If it isn't, then either add add it to the Path, or include the full path to fpc.exe in your compile command.
Btw, when you said
I have a fpc.exe executable file that is supposed to transfer the * .pas file to * .exe file
actually that is not quite right. You don't have the executable file, the executable file is what you are trying to create from the Hello.Pas file by compiling it using fpc.
when I click on the fpc file, it immediately prompts me to use and tells me to hit enter
I assume you mean that this happens when you click fpc.exe in an Explorer window. I'm afraid there is no easy way to avoid this - the same thing happens if you just type
C:>fpc
in a command window. It is just listing the various compiler options, etc, that you could specify. The way you avoid that in a command window is to specify the name of the source file you want to compile. Unfortunately, there isn't a simple way of specifying the source file when you click fpc. For Explorer, it is easiest to write a batch file which prompts you for the source file name and then invokes fpc to compile it.
You should omit the prog.pp in your command line and just enter
fpc C:\Hello.pas (if the file really is located in the root of C:).
If FPC does not find errors, you should have a file C:\Hello.exe.

How can I gain permission to rename a file for my Ruby program?

As per the answer to this question, I am trying to backup a file by renaming it, before I replace it with a new, modified file with the old name.
As per the comments and the documentation here, I am using the following line of code:
File.rename(File.basename(modRaw), File.basename(modRaw)+'.bak')
However, when I do so, I get the following error at runtime:
The program then aborts. (leatherReplacer.rb is the name of my program, and line 88 is the above line of code)
How do I allow my program to rename the files it needs to to run successfully?
Windows has some special rules regarding permissions. The important one at work here, is that the OS prevents moving or renaming a file while the file is open.
Depending on the nature of your code (in size and scope) and the importance of the file you're trying to back up, it may be unfeasible or otherwise not worthwhile to refactor the code in such a way as to make backups possible.
You probably don't want to be calling File.basename in there, that strips off the directory:
Returns the last component of the filename given in *file_name*, which must be formed using forward slashes ("/") regardless of the separator used on the local file system.
So, if modRaw is /where/is/pancakes.house, then you're saying:
File.rename('pancakes.house', 'pancakes.house.bak')
But pancakes.house probably isn't in the script's current directory. Try without the File.basename calls:
File.rename(modRaw, modRaw + '.bak')
If you are owner of that file, use File.chmod to set desired permissions.
I don't know much about ruby, but could you run it under command line/bash with admin privileges, such as "run as administrator" or "su root"?
According to Objectmix and ruby-forum, you should set it to 755 or +x, then perhaps chown to yourself.
try using full file path e.t
File.rename('c:\pancakes.house', 'c:\pancakes.house.bak')
in win7 i encounter same problem

Resources