How to open a file in D drive through command prompt - command

Path of the folder: D:\Brian\adrk_v1_0 ; this folder has a file called 'filename' I wish to open the file, 'filename' using the command prompt.
I tried doing it, by writing the following
C:\Users\Anshuman
C:\Users\Anshuman> cd /d D:Brian\adrk_v1_0
D:\Brian\adrk_v1_0>
But when I try to open the 'makefile' this happens:
Directory of D:\Brian\adrk_v1_0
03-10-2021 11:13 <DIR> .
03-10-2021 11:13 <DIR> ..
13-12-2002 22:16 <DIR> Const
13-12-2002 22:16 <DIR> Energy
13-12-2002 22:16 <DIR> Form
13-12-2002 22:16 <DIR> GMICPP
13-12-2002 22:16 <DIR> Group
13-12-2002 22:16 <DIR> Input
14-12-2002 04:13 1,046 i_data.txt
11-12-2002 03:50 3,294 makefile
13-12-2002 22:16 <DIR> Master
13-12-2002 22:16 <DIR> Output
14-12-2002 04:20 223 o_rmv.dat
14-12-2002 04:20 3,718 o_sdf.dat
14-12-2002 04:20 223 o_sum.dat
14-12-2002 04:20 151 o_vac.dat
13-12-2002 22:16 <DIR> PD
14-12-2002 06:16 2,394 readme.txt
13-12-2002 22:16 <DIR> SDF
13-12-2002 22:16 <DIR> Vector
7 File(s) 11,049 bytes
13 Dir(s) 579,931,025,408 bytes free
D:\Brian\adrk_v1_0>makefile
'makefile' is not recognized as an internal or external command,
operable program or batch file.
I have tried changing the path to C: System 32 in the environment variable.

Looks like you should specify a texteditor, for Example:
notepad makefile

Related

Serialization error due to different folder structure on local and server machine

I am getting following error in my server tomcat logs:-
ERROR: The serialization policy file '/nos/js/4937711D6147993DCFE47FF203A0FEDC.gwt.rpc' was not found; did you forget to include it in this deployment?
On my local machine the above path is present and tomcat is able to locate it and hence I don't get this error. All the folders are present inside nos folder.
But on server, all the folders are present inside ROOT and nos folder is not present and hence server tomcat is not able to identify this path
I am providing folder structure on my local machine and server below :-
Windows folder structure
Directory: C:\Users\abc.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\nos
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 06-09-2022 09:07 PM classes
d----- 06-09-2022 09:09 PM com.xyz.nos.Common
d----- 06-09-2022 09:07 PM gxt
d----- 06-09-2022 09:10 PM js
d----- 06-09-2022 09:07 PM maven-status
d----- 07-09-2022 05:04 PM META-INF
d----- 06-09-2022 09:07 PM WEB-INF
Linux server folder structure
Directory
[x_qa#webapp-nos-69d5d4865-mzkxz ROOT]$ pwd
/opt/tomcat/webapps/ROOT
[x_qa#webapp-nos-69d5d4865-mzkxz webapps]$ cd ROOT
[x_qa#webapp-nos-69d5d4865-mzkxz ROOT]$ ls -lrt
total 36
drwxr-xr-x 4 root root 4096 Jan 1 1970 nos-10.0.8-SNAPSHOT
drwxr-xr-x 3 root root 4096 Jan 1 1970 maven-status
drwxr-xr-x 7 root root 4096 Jan 1 1970 js
-rw-r--r-- 1 root root 182 Jan 1 1970 index.html
drwxr-xr-x 8 root root 4096 Jan 1 1970 gxt
drwxr-xr-x 2 root root 4096 Jan 1 1970 gwt-unitCache
drwxr-xr-x 3 root root 4096 Jan 1 1970 classes
drwxr-xr-x 1 root root 4096 Jan 1 1970 WEB-INF
drwxr-xr-x 3 root root 4096 Jan 1 1970 META-INF
Can anyone suggest how can I make consistent folder structure between server and local machine by keeping both of these folders in sync ?
Let me know if my understand is incorrect ?

How do I exclude a subfolder of a subfolder in compress-archive

I want to zip a folder containing files, and subfolders containing more files and more subfolders. But I want exclude just one subfolder of a subfolder. I have seen many various complicated answers but none seem to really work on this scenario.
folder structure
temp/
a/
aa/
aaa/
aaaa/
filesinaaaa.txt
filesinaaa.txt
filesinaa.txt
at.txt
b/
bb/
bt.txt
c.txt
I want to exclude all files in a/aa/aaa/ while keeping the resulting zip in the same dir structure. And if possible remove the files that were included in the zip.
So result expected is
temp/
a/
aa/
aaa/
aaaa/
filesinaaaa.txt
filesinaaa.txt
result.zip
In linux it is as simple as
cd temp
zip -rm result.zip . -x "a/aa/aaa/*"
what is the simplest way to do this in powershell?
answers i've tried do not really work on subfolder of a subfolder.
Exclude sub-directories from Compress-Archive Powershell Cmd
How do I exclude a folder in compress-archive
over complicated result
Archive folder without some subfolders and files using PowerShell
You can use 7z CLI to do so, here is the doc explaining the usage of -x option in 7z
Showing an example of the option below for reference
The directory structure explained in the question:
C:\Users\adam_\Desktop\temp〉dir -R
a b c.txt
./a:
aa at.txt
./a/aa:
aaa filesinaa.txt
./a/aa/aaa:
aaaa filesinaaa.txt
./a/aa/aaa/aaaa:
filesinaaaa.txt
./b:
bb bt.txt
./b/bb:
Creating the archive:
PS C:\Users\adam_\Desktop\temp> 7z a -tzip result.zip . -x!a/aa/aaa/*
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive:
5 folders, 4 files, 63 bytes (1 KiB)
Creating archive: result.zip
Add new data to archive: 5 folders, 4 files, 63 bytes (1 KiB)
Files read from disk: 4
Archive size: 1217 bytes (2 KiB)
Everything is Ok
Result archive details:
PS C:\Users\adam_\Desktop\temp> 7z l .\result.zip
7-Zip 19.00 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2019-02-21
Scanning the drive for archives:
1 file, 1217 bytes (2 KiB)
Listing archive: .\result.zip
--
Path = .\result.zip
Type = zip
Physical Size = 1217
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2022-05-05 09:48:37 D.... 0 0 a
2022-05-05 09:48:12 D.... 0 0 a\aa
2022-05-05 09:47:45 D.... 0 0 a\aa\aaa
2022-05-05 09:48:12 ....A 13 13 a\aa\filesinaa.txt
2022-05-05 09:48:37 ....A 13 13 a\at.txt
2022-05-05 09:49:20 D.... 0 0 b
2022-05-05 09:48:58 D.... 0 0 b\bb
2022-05-05 09:49:20 ....A 19 19 b\bt.txt
2022-05-05 09:49:56 ....A 18 18 c.txt
------------------- ----- ------------ ------------ ------------------------
2022-05-05 09:49:56 63 63 4 files, 5 folders

How to reset VSCode extensions for a workspace

I was having issues with a workspace so I tried disabling all of extensions for it. Then the only option was to enable all extensions for the workspace. I have extensions globally configured to be off or on, but I'm not sure how to get a workspace to reset to the global extensions now?
I know I can open a new window up and start manually enable/disabling the extensions in my workspace to match the new fresh window. The problem is that it would then have its own workspace extensions defined, so if I toggled one at a global level it would still have an override.
I also tried deleting the .vscode folder in the workspace, but that doesn't seem to change the extensions for the workspace.
It's not a great method but I guess this works with a lot of manual leg work.
Enable all extensions for workspace
Open a new VSCode window
Goto extensions and filter by #disabled
You can also do #enabled and disable all extensions in the first step if you have more disabled than enabled.
Now you have a list you can target. Just click Disable instead of Disable for Workspace.
I believe this should get your workspace back to normal. There has to be an easier way though. You may also have to toggle enabled extensions to disabled and then back to enabled in case it has a workspace override for them -- I didn't check how it would behave if a new window disabled the extension whether or not it would keep staying on.
I've found a way to reset all settings for a given workspace.
First, navigate to ~/.config/Code/User/workspaceStorage. Inside there, you'll find a lot of folders with seemingly random names. Each folder seems to represent one workspace.
# cd ~/.config/Code/User/workspaceStorage
# ls -la
total 156
drwxr-xr-x 39 micael micael 4096 Feb 18 15:00 .
drwxr-xr-x 6 micael micael 4096 Nov 15 13:05 ..
drwxr-xr-x 2 micael micael 4096 Jan 18 16:09 0cf549e23d37c32c70a7e30998ade1fe
drwxr-xr-x 3 micael micael 4096 Dec 29 17:42 1b637cb30f6c3acc9273df20c84be7aa
drwxr-xr-x 2 micael micael 4096 Jan 17 22:09 2010f3fb6dbb2574f12a5ba614b3b136
drwxr-xr-x 2 micael micael 4096 Feb 18 15:01 a09a9ab934662794ac48730fc950a654
...
Inside each folder, there's a workspace.json file that contains the path of the folder your workspace was created from.
We can use grep to quickly search all those folders for a matching string:
grep -r 'myfolder' ., where myfolder should be the name of the folder your workspace is using.
In this example, my workspace was created from a folder called python-playground:
# grep -r 'python-playground' .
./a09a9ab934662794ac48730fc950a654/workspace.json: "folder": "file:///home/micael/projects/python-playground"
grep: ./a09a9ab934662794ac48730fc950a654/state.vscdb: binary file matches
grep: ./a09a9ab934662794ac48730fc950a654/state.vscdb.backup: binary file matches
In my case, the folder I'm looking for is ./a09a9ab934662794ac48730fc950a654.
You'll likely get a few results, all inside the same folder. Let's first take a look inside the folder:
# ls -la a09a9ab934662794ac48730fc950a654
total 64
drwxr-xr-x 2 micael micael 4096 Feb 18 15:01 .
drwxr-xr-x 39 micael micael 4096 Feb 18 15:00 ..
-rw-r--r-- 1 micael micael 28672 Feb 18 15:01 state.vscdb
-rw-r--r-- 1 micael micael 24576 Feb 18 15:01 state.vscdb.backup
-rw-r--r-- 1 micael micael 64 Feb 18 15:00 workspace.json
# cat a09a9ab934662794ac48730fc950a654/workspace.json
{
"folder": "file:///home/micael/projects/python-playground"
}%
Now, we can either remove this folder or move it elsewhere. Make sure to close VSCode before doing so.
# rm -rf a09a9ab934662794ac48730fc950a654

Can't open .py fileon cmd when working directory folder and path is set

Following is the output from the CMD. Receiving [Errno 2]. Notice a.py is in the folder with python.exe and i am able to launch python through py command.
C:\Users\x\AppData\Local\Programs\Python\Python36>a.py
C:\Users\x\AppData\Local\Programs\Python\Python36\python.exe: can't open file '#': [Errno 2] No such file or directory
C:\Users\x\AppData\Local\Programs\Python\Python36>dir
Volume in drive C has no label.
Volume Serial Number is x
Directory of C:\Users\x\AppData\Local\Programs\Python\Python36
04/02/2018 06:46 PM <DIR> .
04/02/2018 06:46 PM <DIR> ..
04/01/2018 07:30 PM 600 a.py
12/23/2016 08:09 AM 100,504 python.exe
12/23/2016 08:06 AM 52,888 python3.dll
12/23/2016 08:06 AM 3,555,992 python36.dll
12/23/2016 08:09 AM 98,968 pythonw.exe
12/23/2016 07:10 AM 8,434 README.txt
C:\Users\x\AppData\Local\Programs\Python\Python36>py
Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
You have to run like this
python.exe a.py
or if path is set correctly,
python a.py

Mozilla JetPack Invalid Filename

I'm trying to create simple Mozilla add-on which is using external JS file;
Folders & Files
/var/www/html/add-ons/hello
/var/www/html/add-ons/hello/index.js
/var/www/html/add-ons/hello/package.json
/var/www/html/add-ons/hello/script/data/test.js
/var/www/html/add-ons/hello/index.js
// Import the page-mod API
var pageMod = require("sdk/page-mod");
// Create a page-mod
pageMod.PageMod({
include : "*",
contentScriptFile : "./test.js",
contentScript: 'window.alert("loaded");'
});
/var/www/html/add-ons/hello/package.json
{
"title": "My Jetpack Addon",
"name": "test",
"version": "0.0.1",
"description": "A basic add-on",
"main": "index.js",
"author": "",
"engines": {
"firefox": ">=38.0a1",
"fennec": ">=38.0a1"
},
"license": "MIT",
"keywords": [
"jetpack"
]
}
/var/www/html/add-ons/hello/script/data/test.js
alert("Hello World");
Commands I Run to Test
cd /var/www/html/add-ons/hello
jpm init (actually package.json file was created by this command)
jpm run -b /usr/bin/firefox (I use Ubuntu so I run it this way)
I test it live and I get loaded alert however I get following error;
console.error: script:
Error opening input stream (invalid filename?): resource://script/data/test.js
The folders and file are already exist within the root folder.
If this is the root;
/var/www/html/add-ons/hello shouldn't resource://script/data/test.js be referring to /var/www/html/add-ons/hello/script/data/test.js?
Where am I doing wrong?
Create your folder structure as below:
root folder: /var/www/html/add-ons/hello
place index.js, package.json within root folder.
move all the data that is packaged within your add-on to: /var/www/html/add-ons/hello/data
go to root folder - /var/www/html/add-ons/hello
run jpm run -b
this will create an xpi package, launch firefox.exe with temporary profile, install add-on.
ex: this is from win 7 x64 test project:
root directory: E:\Training\using_Angular
Directory of E:\Training\using_Angular
11/01/2015 08:26 AM <DIR> .
11/01/2015 08:26 AM <DIR> ..
09/29/2015 05:04 PM <DIR> data
09/29/2015 05:02 PM 548 index.js
08/12/2015 08:26 PM 221 package.json
Directory of E:\Training\using_Angular\data
09/29/2015 05:04 PM <DIR> .
09/29/2015 05:04 PM <DIR> ..
09/29/2015 05:04 PM <DIR> images
08/12/2015 08:26 PM 446 lang.json
09/29/2015 05:04 PM <DIR> lib
09/29/2015 05:04 PM <DIR> scripts
09/29/2015 05:04 PM <DIR> styles
09/29/2015 05:04 PM <DIR> html
Directory of E:\Training\using_Angular\data\html
08/12/2015 08:26 PM 446 pagescript.html
During run, the 'resource://' folder refers to contents packaged in your add-on.
for ex: resource://caaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/data/html/pagescript.html