日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

shell访问php文件夹,Shell获取某目录下所有文件夹的名称

發布時間:2023/11/27 生活经验 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 shell访问php文件夹,Shell获取某目录下所有文件夹的名称 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Shell獲取某目錄下所有文件夾的名稱以下文字資料是由(歷史新知網www.lishixinzhi.com)小編為大家搜集整理后發布的內容,讓我們趕快一起來看一下吧!

Shell獲取某目錄下所有文件夾的名稱, 已知目錄D:/temp,獲取temp下所有文件夾的名稱并輸出,Shell怎么寫?

方法有三,如下:

#!/bin/bash

#方法一

dir=$(ls?-l?D:/temp/?|awk?'/^d/?{print?$NF}')

for?i?in?$dir

do

echo?$i

done

#######

#方法二

for?dir?in?$(ls?D:/tmep/)

do

[?-d?$dir?]?&&?echo?$dir

done

##方法三

ls?-l?D:/temp/?|awk?'/^d/?{print?$NF}'

##?其實同方法一,直接就可以顯示不用for循環

php 獲取目錄下的所有文件夾名稱

大致思路:

function traverseDir($dir){

if($dir_handle = @opendir($dir)){

while($filename = readdir($dir_handle)){

if($filename != "." && $filename != ".."){

$subFile = $dir.DIRECTORY_SEPARATOR.$filename; 要將源目錄及子文件相連

if(is_dir($subFile)){ 若子文件是個目錄

echo $filename.'
'; 輸出該目錄名稱

traverseDir($subFile); 遞歸找出下級目錄名稱

}

}

}

closedir($dir_handle);

}

}

$dirNames = traverseDir("d:/dos"); 測試某目錄

?>

VBS獲取當前目錄下所有文件夾名字

呵呵,原來是團友啊我寫了一個!Set ws=WScript.CreateObject("wscript.shell")

w=ws.CurrentDirectory

Set fso=WScript.CreateObject("scripting.filesystemobject")

Set fs=fso.GetFolder(w)

Set f=fs.SubFolders

For Each uu In f

t=t & uu.Path & vbcrlf

Next

MsgBox t

使用VB獲得目錄下所有文件夾名稱的問題

用FSO對象模型不是很好么,這種代碼看的好痛苦哇!

C# 獲取Ftp某個目錄下的所有文件(不要文件夾)

我在之前做過一個FTP的客戶端工具。

drw 文件夾

-rw 文件(有擴展名或無擴展名)

我是根據服務端返回的報文進行分析獲取的列表。

給你一些代碼片段:

/

/ 獲取指定目錄下的文件和文件夾。

/

/ 要獲取的目錄

/ 要發送到FTP服務器的密令。

/

public string[] GetFileList(string path, string WRMethods)從ftp服務器上獲得文件列表

{

WebResponse response;

string[] downloadFiles;

int conut = 4;

StringBuilder result = new StringBuilder();

Connect(path);

if (FTPVariable.IsUseProxy_ftp)

{

reqFTP.Proxy = FtpProxy.GetFtpSelectProxy(FTPVariable.FtpCommand_transferProxyName);

}

reqFTP.ReadWriteTimeout = 12000;

如果不應銷毀到服務器的連接,則為 true;否則為 false。默認值為 true。

reqFTP.Method = WRMethods;

try

{

response = (FtpWebResponse)reqFTP.GetResponse();

goto Ftp_lbl_03;

}

catch (WebException webex)

{

GetReply(webex.Message);

if (ReplyCode == 530) 未登錄。

{

goto Ftp_lbl_04;

}

else if (ReplyCode == 550)

{

goto Ftp_lbl_04;

}

else

{

FtpManage.SetLog("獲取列表超時,等候1秒后重試!");

goto Ftp_lbl_01;

}

}

Ftp_lbl_01:

try

{

FtpManage.SetLog("正在連接服務器 " + FtpRemoteHost);

response = GetRequest(path, WRMethods);

}

catch (WebException)

{

FtpManage.SetLog("獲取列表超時,等候1秒后重試!");

downloadFiles = null;

System.Threading.Thread.Sleep(1000);

if (conut == 0)

{

goto Ftp_lbl_02;

}

conut--;

goto Ftp_lbl_01;

}

catch (Exception ex)

{

MSG.Show(ex.Message, Global.GetRS["msgTilteError"], MessageBoxButton.OK, MsgIco.Error);

FtpManage.SetLog("命令執行失敗,原因:" + ex.Message);

downloadFiles = null;

return downloadFiles;

}

Ftp_lbl_03:

StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default);中文文件名

string line = reader.ReadLine();

while (line != null)

{

result.Append(line);

result.Append("\n");

line = reader.ReadLine();

}

if (result.Length == 0)

{

return null;

}

to remove the trailing '\n'

result.Remove(result.ToString().LastIndexOf('\n'), 1);

reader.Close();

response.Close();

FtpManage.SetLog("命令已成功執行");

return result.ToString().Split('\n');

Ftp_lbl_04:

FtpManage.SetLog(ReplyInfo);

return null;

Ftp_lbl_02:

FtpManage.SetLog("550 獲取列表失敗,無法連接遠程服務器!");

FtpManage.ftpmanage.IsRefurbish = true;

return null;

}

/

/ 獲取指定目錄下的文件和文件夾。

/

/ 要獲取的目錄

/

public string[] GetFileList(string path)從ftp服務器上獲得文件列表

{

return GetFileList(FTPVariable.FtpURLhead + FtpRemoteHost + "/" + path, WebRequestMethods.Ftp.ListDirectory);

}

/

/ 獲取指定目錄下的文件和文件夾。

/

/

public string[] GetFileList()從ftp服務器上獲得文件列表

{

return GetFileList(FTPVariable.FtpURLhead + FtpRemoteHost + "/", WebRequestMethods.Ftp.ListDirectory);

}

/

/ 獲取目錄和文件名,返回目錄表。

/

/ 要獲取的目錄

/

public string[] GetCatalog_FileList(string path)

{

string[] fountainhead = GetFileList(FTPVariable.FtpURLhead + FtpRemoteHost + "/" + path, WebRequestMethods.Ftp.ListDirectoryDetails);

string[] Catalog = null;

if (fountainhead == null)

{

return null;

}

Catalog = new string[fountainhead.Length];

for (int i = 3; i < fountainhead.Length; i++)

{

Catalog[i - 3] += fountainhead[i].Substring(55, fountainhead[i].Length - 55) + "&";FileName

Catalog[i - 3] += fountainhead[i].Substring(30, 12) + "&";FileSize

Catalog[i - 3] += fountainhead[i].Substring(42, 13) + "&";AmendDate

Catalog[i - 3] += fountainhead[i].Substring(0, 3) + "&";

}

return Catalog;

}

請問ASP中如何獲取某個目錄中所有文件夾的名稱?

fso.GetFolder(path)

shell編程如何獲取指定目錄下所有文件的名稱,例:目錄:/root/dira/下的 001.DAT…009.DAT 9個文件名稱?

你剛才不是問過了么?

vb 如何讀取某目錄下所有文件及子文件夾

查找某目錄下所有 文件 及 子文件夾

試一試不用 FileSystemObject 對象,只用基本控件的代碼。

'例子需控件:Command1,List1,List2,File1,Dir1,都采用默認屬性。

'例如,查找 C:\ ,帶 '** 的語可修改

Dim ctFind As Boolean

Private Sub Form_Load()

Me.Caption = "查找所有文件及文件夾"

Command1.Caption = "查找"

List2.Visible = False: File1.Visible = False: Dir1.Visible = False

Label1.Caption = "就緒"

End Sub

Private Sub Form_Unload(Cancel As Integer)

End

End Sub

Private Sub Form_Resize()

Dim W As Long

On Error Resume Next

W = 720

List1.Move 0, 0, Me.ScaleWidth - W - 120, Me.ScaleHeight - 300

Command1.Move Me.ScaleWidth - W - 60, 300, W

Label1.Move 90, Me.ScaleHeight - 255, Screen.Width, 255

End Sub

Private Sub Command1_Click()

ctFind = Not ctFind

If ctFind Then

Command1.Caption = "取消"

Call FindDirFile("C:") '**查找 C:\ 下的所有文件和目錄,或 C:\Windows 等

Command1.Caption = "查找"

Else

Command1.Caption = "查找"

End If

End Sub

Private Sub FindDirFile(ByVal nPath As String)

Dim I As Long, nDir As String, Ci As Long

ctFind = True

List1.Clear: List2.Clear

If Right(nPath, 1) <> "\" Then nPath = nPath & "\"

List1.AddItem "查找 " & nPath: List2.AddItem nPath

File1.Pattern = "*"

File1.System = True: File1.Hidden = True: File1.ReadOnly = True

On Error GoTo Cuo

Dir1.Path = nPath

On Error GoTo 0

Do

If List2.ListCount = 0 Then Exit Do

nPath = List2.List(0)

List2.RemoveItem 0

Dir1.Path = nPath

For I = 0 To Dir1.ListCount - 1

GoSub ShowGe

nDir = Dir1.List(I)

If Right(nDir, 1) <> "\" Then nDir = nDir & "\"

List1.AddItem "■" & nDir

List2.AddItem nDir

Next

File1.Path = nPath

For I = 0 To File1.ListCount - 1

GoSub ShowGe

List1.AddItem " " & nPath & File1.List(I)

Next

Loop

Label1.Caption = "查找完畢,共找到 " & List1.ListCount & " 個條目"

ctFind = False

Exit Sub

Cuo:

List1.AddItem "起始目錄不存在:" & nPath

ctFind = False

Exit Sub

ShowGe:

Ci = Ci + 1

If Ci < 99 Then Return

Ci = 0

Label1.Caption = "已找到 " & List1.ListCount & " 個:" & nPath

DoEvents

If ctFind Then Return

End Sub

linux shell腳本怎么獲取目錄下所有txt文件名稱

執行如下三條命令即可:

(1)、$script myresultfile

(2)、$ls -al *.txt

(3)、$exit

此時,該目錄下的所有 txt 文件名稱就會以長格式保存在 myresultfile 文件中了。

然后你再使用 SHELL 編程的功能把那些無用的列去掉即可。

分頁:123

總結

以上是生活随笔為你收集整理的shell访问php文件夹,Shell获取某目录下所有文件夹的名称的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。