简体   繁体   English

我如何从另一个目录访问目录中的文件(linux)

[英]how do i access files in directory from another directory (linux)

im trying to change permissions on a txt file founded in directory X While im in the directory Y我试图更改在目录 X 中创建的 txt 文件的权限,而我在目录 Y 中

  kosay_sabbah@DESKTOP-87R0T4M:~/Kosay/grp2$ chmod 777 3.txt

  chmod: cannot access '3.txt': No such file or directory

You should use absolute or relative file path.您应该使用绝对或相对文件路径。 For example you have file1.txt in directory /directory1/ - absolute file path is /directory1/file1.txt .例如,您在目录/directory1/中有file1.txt - 绝对文件路径是/directory1/file1.txt If your current path is /directory2/ , you can run chmod for file1.txt in two ways:如果您当前的路径是/directory2/ ,您可以通过两种方式为 file1.txt 运行chmod

  1. Using relative path - chmod../directory1/file1.txt使用相对路径 - chmod../directory1/file1.txt

  2. Using absolute path - chmod /directory1/file1.txt使用绝对路径 - chmod /directory1/file1.txt

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在LINUX的另一个目录中有选择地创建指向特定文件的符号链接? - How do I selectively create symbolic links to specific files in another directory in LINUX? 如何在Linux中将具有特定扩展名的文件从一个目录复制到另一个目录 - How to copy files with a particular extension from one directory to another in linux 如何将文件从 linux 目录复制到另一个给定长度参数 - How to copy files from a linux directory to another given a length parameter 如何根据 linux 中的名称将文件移动到新目录? - How do I move files to a new directory based on their name in linux? 如何在linux中打印另一个用户的当前工作目录? - How do I print the current working directory of another user in linux? 如何以字母顺序的另一种顺序访问或排序目录中的文件? - how do I access or sort the files of a directory in another order that the alphabetical order? 在Linux中,如何为目录设置权限,以防止用户列出,删除或创建其中的文件? - In Linux how do I set permissions for a directory that prevent a user from listing, deleting or creating files within? 如何使用 python 将几个文件夹从一个目录复制到 Linux 中的另一个文件夹 - how do I copy over a few folders from one directory into another folder in Linux using python 如何在Linux中序列化对目录的访问? - How can I serialize access to a directory in Linux? 如何在Linux上的Active Directory中为Tomcat创建.keytab? - How do I create a .keytab from Active Directory for Tomcat on Linux?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM