首页 \ 问答 \ Google API v2无效(Google API v2 Not Work)

Google API v2无效(Google API v2 Not Work)

那我的代码!

ActivityMain

package com.example.googlemap;

import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity
{
   @Override
   protected void onCreate(Bundle arg0)
   {
      // TODO Auto-generated method stub        
      super.onCreate(arg0);
      setContentView(R.layout.activity_main);

      SupportMapFragment fragment = new SupportMapFragment();
      getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
   }
}

main.xml中

<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:map="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingBottom="@dimen/activity_vertical_margin"
     android:paddingLeft="@dimen/activity_horizontal_margin"
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
     tools:context=".MainActivity" >    <fragment
           android:id="@+id/map"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           class="com.google.android.gms.maps.SupportMapFragment"
           /> </RelativeLayout>

表现

 <?xml version="1.0" encoding="utf-8"?> <manifest
 xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.example.googlemap"
     android:versionCode="1"
     android:versionName="1.0" >

     <uses-sdk
         android:minSdkVersion="8"
         android:targetSdkVersion="18" />

     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
 />
     <!--
      The following two permissions are not required to use
      Google Maps Android API v2, but are recommended.
     -->
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

     <uses-feature
         android:glEsVersion="0x00020000"
         android:required="true"/>

     <application
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
             android:name="com.example.googlemap.MainActivity"
             android:label="@string/app_name" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />

                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
     </application>

     <meta-data
         android:name="com.google.android.maps.v2.API_KEY"
         android:value="AIzaSyAlBNf0GETrO0RdifpWH39ztBR7Cz1iyzE" />

 </manifest>

和我的logcat

09-25 14:19:32.644: D/dalvikvm(2152): GC_CONCURRENT freed 154K, 2%
 free 16455K/16636K, paused 2ms+1ms, total 5ms 09-25 14:19:32.660:
 D/AndroidRuntime(2152): Shutting down VM 09-25 14:19:32.660:
 W/dalvikvm(2152): threadid=1: thread exiting with uncaught exception
 (group=0xa6208908) 09-25 14:19:32.664: E/AndroidRuntime(2152): FATAL
 EXCEPTION: main 09-25 14:19:32.664: E/AndroidRuntime(2152):
 java.lang.RuntimeException: Unable to start activity
 ComponentInfo{com.example.googlemap/com.example.googlemap.MainActivity}:
 android.view.InflateException: Binary XML file line #11: Error
 inflating class fragment 09-25 14:19:32.664: E/AndroidRuntime(2152):
    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.ActivityThread.access$600(ActivityThread.java:141) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.os.Handler.dispatchMessage(Handler.java:99) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.os.Looper.loop(Looper.java:137) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 android.app.ActivityThread.main(ActivityThread.java:5041) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 java.lang.reflect.Method.invokeNative(Native Method) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 java.lang.reflect.Method.invoke(Method.java:511) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 dalvik.system.NativeStart.main(Native Method) 09-25 14:19:32.664:
 E/AndroidRuntime(2152): Caused by: android.view.InflateException:
 Binary XML file line #11: Error inflating class fragment 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.inflate(LayoutInflater.java:489) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.inflate(LayoutInflater.java:396) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.inflate(LayoutInflater.java:352) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.Activity.setContentView(Activity.java:1881) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.example.googlemap.MainActivity.onCreate(MainActivity.java:16)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.Activity.performCreate(Activity.java:5104) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    ... 11 more 09-25
 14:19:32.664: E/AndroidRuntime(2152): Caused by:
 java.lang.RuntimeException: API key not found.  Check that <meta-data
 android:name="com.google.android.maps.v2.API_KEY" android:value="your
 API key"/> is in the <application> element of AndroidManifest.xml
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at maps.ag.bb.a(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 maps.ag.bb.a(Unknown Source) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at maps.ag.an.a(Unknown Source) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at maps.ag.bh.a(Unknown Source)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at maps.ag.bg.a(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 bob.onTransact(SourceFile:107) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 android.os.Binder.transact(Binder.java:310) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 com.google.android.gms.dynamic.a$4.b(Unknown Source) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.google.android.gms.dynamic.a.a(Unknown Source) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 com.google.android.gms.dynamic.a.onCreateView(Unknown Source) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:285)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    ... 21 more

that my code!

ActivityMain

package com.example.googlemap;

import com.google.android.gms.maps.SupportMapFragment;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

public class MainActivity extends FragmentActivity
{
   @Override
   protected void onCreate(Bundle arg0)
   {
      // TODO Auto-generated method stub        
      super.onCreate(arg0);
      setContentView(R.layout.activity_main);

      SupportMapFragment fragment = new SupportMapFragment();
      getSupportFragmentManager().beginTransaction().add(android.R.id.content, fragment).commit();
   }
}

main.xml

<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     xmlns:map="http://schemas.android.com/apk/res-auto"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingBottom="@dimen/activity_vertical_margin"
     android:paddingLeft="@dimen/activity_horizontal_margin"
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
     tools:context=".MainActivity" >    <fragment
           android:id="@+id/map"
           android:layout_width="match_parent"
           android:layout_height="match_parent"
           class="com.google.android.gms.maps.SupportMapFragment"
           /> </RelativeLayout>

Manifest

 <?xml version="1.0" encoding="utf-8"?> <manifest
 xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.example.googlemap"
     android:versionCode="1"
     android:versionName="1.0" >

     <uses-sdk
         android:minSdkVersion="8"
         android:targetSdkVersion="18" />

     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
 />
     <!--
      The following two permissions are not required to use
      Google Maps Android API v2, but are recommended.
     -->
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

     <uses-feature
         android:glEsVersion="0x00020000"
         android:required="true"/>

     <application
         android:allowBackup="true"
         android:icon="@drawable/ic_launcher"
         android:label="@string/app_name"
         android:theme="@style/AppTheme" >
         <activity
             android:name="com.example.googlemap.MainActivity"
             android:label="@string/app_name" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />

                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
     </application>

     <meta-data
         android:name="com.google.android.maps.v2.API_KEY"
         android:value="AIzaSyAlBNf0GETrO0RdifpWH39ztBR7Cz1iyzE" />

 </manifest>

and My logcat

09-25 14:19:32.644: D/dalvikvm(2152): GC_CONCURRENT freed 154K, 2%
 free 16455K/16636K, paused 2ms+1ms, total 5ms 09-25 14:19:32.660:
 D/AndroidRuntime(2152): Shutting down VM 09-25 14:19:32.660:
 W/dalvikvm(2152): threadid=1: thread exiting with uncaught exception
 (group=0xa6208908) 09-25 14:19:32.664: E/AndroidRuntime(2152): FATAL
 EXCEPTION: main 09-25 14:19:32.664: E/AndroidRuntime(2152):
 java.lang.RuntimeException: Unable to start activity
 ComponentInfo{com.example.googlemap/com.example.googlemap.MainActivity}:
 android.view.InflateException: Binary XML file line #11: Error
 inflating class fragment 09-25 14:19:32.664: E/AndroidRuntime(2152):
    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.ActivityThread.access$600(ActivityThread.java:141) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.os.Handler.dispatchMessage(Handler.java:99) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.os.Looper.loop(Looper.java:137) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 android.app.ActivityThread.main(ActivityThread.java:5041) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 java.lang.reflect.Method.invokeNative(Native Method) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 java.lang.reflect.Method.invoke(Method.java:511) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 dalvik.system.NativeStart.main(Native Method) 09-25 14:19:32.664:
 E/AndroidRuntime(2152): Caused by: android.view.InflateException:
 Binary XML file line #11: Error inflating class fragment 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.inflate(LayoutInflater.java:489) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.inflate(LayoutInflater.java:396) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.view.LayoutInflater.inflate(LayoutInflater.java:352) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.Activity.setContentView(Activity.java:1881) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.example.googlemap.MainActivity.onCreate(MainActivity.java:16)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.Activity.performCreate(Activity.java:5104) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    ... 11 more 09-25
 14:19:32.664: E/AndroidRuntime(2152): Caused by:
 java.lang.RuntimeException: API key not found.  Check that <meta-data
 android:name="com.google.android.maps.v2.API_KEY" android:value="your
 API key"/> is in the <application> element of AndroidManifest.xml
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at maps.ag.bb.a(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 maps.ag.bb.a(Unknown Source) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at maps.ag.an.a(Unknown Source) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at maps.ag.bh.a(Unknown Source)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at maps.ag.bg.a(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 bob.onTransact(SourceFile:107) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 android.os.Binder.transact(Binder.java:310) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 com.google.android.gms.maps.internal.IMapFragmentDelegate$a$a.onCreateView(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 com.google.android.gms.maps.SupportMapFragment$a.onCreateView(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 com.google.android.gms.dynamic.a$4.b(Unknown Source) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.google.android.gms.dynamic.a.a(Unknown Source) 09-25 14:19:32.664:
 E/AndroidRuntime(2152):    at
 com.google.android.gms.dynamic.a.onCreateView(Unknown Source) 09-25
 14:19:32.664: E/AndroidRuntime(2152):  at
 com.google.android.gms.maps.SupportMapFragment.onCreateView(Unknown
 Source) 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:900)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1082)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentManagerImpl.addFragment(FragmentManager.java:1184)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:285)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    at
 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
 09-25 14:19:32.664: E/AndroidRuntime(2152):    ... 21 more

原文:https://stackoverflow.com/questions/18998972
更新时间:2023-09-07 21:09

最满意答案

给这个镜头。 你可以改变任何你想要的rootdir,output_dir和百分比。

import os, shutil
from random import choice

rootdir = 'C:/images'
output_dir = 'C:/copies'
for subdir, dir, files in os.walk(rootdir):
    if files:
        for x in range(int(len(files) *.25)):
            to_copy = choice(files)
            shutil.copy(os.path.join(subdir, to_copy), os.path.join(output_dir, to_copy))
            files.remove(to_copy)

Give this a shot. You can change the rootdir, output_dir, and percentage to whatever you want.

import os, shutil
from random import choice

rootdir = 'C:/images'
output_dir = 'C:/copies'
for subdir, dir, files in os.walk(rootdir):
    if files:
        for x in range(int(len(files) *.25)):
            to_copy = choice(files)
            shutil.copy(os.path.join(subdir, to_copy), os.path.join(output_dir, to_copy))
            files.remove(to_copy)

相关问答

更多
  • 在这两个版本中, SourceFile = Dir()都在ActiveCell.Value = SourceFile之上。 这会导致在将文件名添加到列表之前跳过列表中的下一个文件而错过第一个文件。 更正代码: Dir()版本: FilePath = "C:\Test\" SourceFile = Dir(FilePath & "*.xls*") Do While SourceFile <> "" ActiveCell.Value = SourceFile ActiveCell.Offs ...
  • 有两种方法可以解决这个问题,但我认为第二种方法是优越的。 1 - 在继续之前检查文件是否存在 只需添加一个File.exist?(f)检查您的代码: def transcode_process_1 Dir["path/file/source/*.mxf"].each do |f| next if !File.exist?(f) ..carry on as normal.. 2 - 使用队列(Threads包的一部分) 您可以使用可由所有线程访问的队列。 这以多种方式 ...
  • 当然,一旦你停止一个宏,没有任何变量值的持久化 虽然观察到的行为是由于以下原因: 1) FileDialog对象保留在其IntialFileName属性中选择的最后一个路径 2)将空字符串作为“path”的Dir(path)函数将返回最后一个FileDialog运行时存储的IntialFileName路径中的第一个文件 所以当你重新运行宏时: NewDataFilePath是一个空字符串 a = Dir(NewDataFilePath)将返回匹配过滤器的IntialFileName路径中的第一个文件(如果有 ...
  • 给这个镜头。 你可以改变任何你想要的rootdir,output_dir和百分比。 import os, shutil from random import choice rootdir = 'C:/images' output_dir = 'C:/copies' for subdir, dir, files in os.walk(rootdir): if files: for x in range(int(len(files) *.25)): to_cop ...
  • 行为是正确的,并且“按预期”。 for file in $InputDir'*'表示assign "/home/XXX/*" to $file (注意引号)。 既然你引用了星号,它现在不会被执行。 当shell看到echo $file ,它首先展开变量,然后进行glob扩展。 所以在第一步之后,它就会看到 echo /home/XXX/* 在全局扩展之后,它会看到: echo /home/XXX/fileA /home/XXX/fileB 直到现在,它才会执行命令。 在第二种情况下,在执行for之前扩展 ...
  • 这是要求底层操作系统执行繁重操作可能更有效的时候之一,特别是如果你正在梳理大量文件: %x[ls -rU *.json | tail -10].split("\n") 在将打开shell的Mac OS上,按其创建日期以相反的顺序对所有'* .json'文件进行排序,返回最后十个。 名称将以字符串形式返回,因此split会将它们分成行末端的数组。 ls和tail命令非常快,并且在编译的C代码中完成它们的工作,避免了我们在Ruby中必须做的循环来过滤掉事情。 这方面的缺点是它依赖于操作系统。 Windows可 ...
  • 您所有问题的答案都在手册页中: A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You can think of a trailing / on a source as meaning "copy the contents of this directory" as opposed to "copy the d ...
  • '' 表示当前目录 '..'表示父目录 它们由'dir'命令返回。 在你的情况下(以及我见过的任何其他)他们只是妨碍了,所以代码特别忽略了它们 '.' means the current directory '..' means the parent directory They are returned by the 'dir' command. In your case (and any other I have seen) they just get in the way and so the cod ...
  • 我会说去正则表达式。 Private Sub TeamTxtExists() Dim Path As String, Pattern As String, FileFound As String Dim REGEX As Object, Matches As Object Dim oFSO As Object, oFolder As Object, oFile As Object Path = "D:\Personal\Stack Overflow\" 'Modify a ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)